for in two dimensional array
Original Reporter info from Mantis: marco @marcoonthegit
-
Reporter name: Marco van de Voort
Original Reporter info from Mantis: marco @marcoonthegit
- Reporter name: Marco van de Voort
Description:
Using for x in y if y is an two dimensional array of x works fine, but I can't see this possibility mentioned in the docs. (static? Dynamic?)
Steps to reproduce:
{$mode delphi}
// compiles in delphi and fpc and prints all elements of array.
uses
SysUtils;
type TTestClass = class
x,y: Integer;
procedure print;
end;
TTestclassarray = array[0..10] of ttestclass;
var twod : array[0..3] of TTestclassarray;
procedure TTestClass.print;
begin
writeln(x,':',y);
end;
var i,j : integer;
n : TTestClass;
begin
for i:=0 to 3 do
begin
for j:=0 to 10 do
begin
twod[i][j]:=TTestClass.Create;
twod[i][j].x:=i;
twod[i][j].y:=j;
end;
end;
for n in twod do
n.print;
readln;
end.
Mantis conversion info:
- Mantis ID: 33138
- Fixed in version: 3.1.1
- Fixed in revision: 1465 (#5bfb0ffc)
- Target version: 3.2.0