blob: 82c39babd1c8feb7f1e3846aa7b0e095266e9cfc (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
var
str: bitpacked array [1..6] of 'a'..'z';
i: integer;
ch: char;
error: boolean;
begin
error := false;
for i := 1 to 6 do str[i] := chr(ord('a')+i-1);
for i := 1 to 6 do begin
write('str[i] = ''', str[i], '''; ord(str[2]) = ',ord(str[i]));
ch:=str[i]; {if we had used directly str[i] in the expression below, the correct value would have been read}
if ch <> chr(ord(str[i])) then
begin
write(' ==> Bug: chr(',ord(ch),') read, excpected chr(',ord('a')+i-1,')');
error:=true;
end;
writeln;
end;
halt(ord(error));
end.
|