Show ASCII table: Difference between revisions

Content added Content deleted
(→‎{{header|ALGOL 68}}: (Very) Minor simplification)
(→‎{{header|ALGOL W}}: Simplify and show the table vertically, as most of the other samples do)
Line 473: Line 473:


=={{header|ALGOL W}}==
=={{header|ALGOL W}}==
This assumes the ASCII character set is used by the Algol W compiler/runtime - the original Algol W implementation used EBCDIC.
<syntaxhighlight lang="algolw">begin
% generate an ascii table for chars 32 - 127 %
<syntaxhighlight lang="algolw">% generate an ascii table for chars 32 - 127 %
for i := 32 until 32 + 15 do begin
integer cPos;
cPos := 0;
write();
for i := 32 until 127 do begin
for c := i step 16 until i + ( 16 * 5 ) do begin
if cPos = 0 then write();
writeon( i_w := 3, s_w := 0, c, ": " );
cPos := ( cPos + 1 ) rem 6;
if c = 32 then writeon( "Spc ")
writeon( i_w := 3, s_w := 0, i, ": " );
else if c = 127 then writeon( "Del " )
if i = 32 then writeon( "Spc ")
else writeon( code( c ), " " )
end for_ach
else if i = 127 then writeon( "Del " )
end for_i.
else writeon( code( i ), " " )
</syntaxhighlight>
end for_i
end.</syntaxhighlight>
{{out}}
{{out}}
<pre>
<pre> 32: Spc 33: ! 34: " 35: # 36: $ 37: %
38: & 39: ' 40: ( 41: ) 42: * 43: +
32: Spc 48: 0 64: @ 80: P 96: ` 112: p
44: , 45: - 46: . 47: / 48: 0 49: 1
33: ! 49: 1 65: A 81: Q 97: a 113: q
50: 2 51: 3 52: 4 53: 5 54: 6 55: 7
34: " 50: 2 66: B 82: R 98: b 114: r
56: 8 57: 9 58: : 59: ; 60: < 61: =
35: # 51: 3 67: C 83: S 99: c 115: s
62: > 63: ? 64: @ 65: A 66: B 67: C
36: $ 52: 4 68: D 84: T 100: d 116: t
68: D 69: E 70: F 71: G 72: H 73: I
37: % 53: 5 69: E 85: U 101: e 117: u
74: J 75: K 76: L 77: M 78: N 79: O
38: & 54: 6 70: F 86: V 102: f 118: v
80: P 81: Q 82: R 83: S 84: T 85: U
39: ' 55: 7 71: G 87: W 103: g 119: w
86: V 87: W 88: X 89: Y 90: Z 91: [
40: ( 56: 8 72: H 88: X 104: h 120: x
92: \ 93: ] 94: ^ 95: _ 96: ` 97: a
41: ) 57: 9 73: I 89: Y 105: i 121: y
98: b 99: c 100: d 101: e 102: f 103: g
42: * 58: : 74: J 90: Z 106: j 122: z
104: h 105: i 106: j 107: k 108: l 109: m
43: + 59: ; 75: K 91: [ 107: k 123: {
110: n 111: o 112: p 113: q 114: r 115: s
44: , 60: < 76: L 92: \ 108: l 124: |
116: t 117: u 118: v 119: w 120: x 121: y
45: - 61: = 77: M 93: ] 109: m 125: }
122: z 123: { 124: | 125: } 126: ~ 127: Del</pre>
46: . 62: > 78: N 94: ^ 110: n 126: ~
47: / 63: ? 79: O 95: _ 111: o 127: Del
</pre>


=={{header|APL}}==
=={{header|APL}}==