Code: Alles auswählen
program project1;
uses
JS, Classes, SysUtils, Web, browserconsole;
procedure onload;
type
TCharArray = array of char;
TByteArray = array of byte;
var
ba: TByteArray;
ca: TCharArray;
i: integer;
begin
SetLength(ca, 10);
for i := 0 to Length(ca) - 1 do begin
ca[i] := char(byte('A')+i);
end;
ba := TByteArray(ca);
Writeln('ba: ', Length(ba));
Writeln('ca: ', Length(ca));
for i := 0 to Length(ba) - 1 do begin
Write(ba[i], ' - ');
end;
Writeln;
for i := 0 to Length(ca) - 1 do begin
Write(ca[i], ' - ');
end;
end;
begin
onload;
end.
Code: Alles auswählen
ba: 10
ca: 10
65 - 66 - 67 - 68 - 69 - 70 - 71 - 72 - 73 - 74 -
A - B - C - D - E - F - G - H - I - J -
Code: Alles auswählen
ba: 10
ca: 10
A - B - C - D - E - F - G - H - I - J - A - B - C - D - E - F - G - H - I - J -
Mache ich dies mit einem einfachen Char und Byte funktioniert es wie erwartet.
Code: Alles auswählen
var
ch: char;
by: byte;
begin
ch := #65;
Writeln(ch); // -> A
by := byte(ch);
Writeln(by); // -> 65
Sehe ich das richtig, das pas2j2 generell Probleme mit Pascal-Array hat ?