Die Sorucen von Lazarus&FPC sind schon eine ware Goldgrube...
Dies war ursprünglich Delphi-Code. Aber es stimmt schon Pascal bietet recht vieles für ein komfortables Coden.
Die Sorucen von Lazarus&FPC sind schon eine ware Goldgrube...
Mathias hat geschrieben:Ich habe gerade eine Merkwürdige Deklaration entdeckt:Code: Alles auswählen
type
Ta = array[(a, b, c, d)] of byte;
var
m:Ta;
begin
m[a]:=123;
m[b]:=456;
Dies wird anstandslos kompiliert.
Code: Alles auswählen
type
indextyp = (a, b, c, d); //aufzählung
Ta = array[indextyp] of byte;
Code: Alles auswählen
type
TBA = array of byte;
var
BA: TBA;
begin
BA := TBA.Create(5, 2, 3, 4, 1);
WriteLn(Length(BA)); // --> 5
WriteLn(BA[2]); // --> 3
Code: Alles auswählen
SetLength(BA, 5);
BA[0] := 5;
BA[1] := 2;
BA[2] := 3;
BA[3] := 4;
BA[4] := 1;