[fpc-devel] for-in-index loop

Daniël Mantione daniel.mantione at freepascal.org
Fri Jan 25 17:33:02 CET 2013



Op Sat, 26 Jan 2013, schreef Alexander Klenin:

> With this in mind, consider a user who wants to iterate over the
> following array:
>
> var
>  a: array [1..5] of Integer = (1, 2, 9, 4, 5);
>
> In my proposal, he should write:
> var
>  v, i: Integer;
> begin
>  for a in a index i do
>    Writeln(i, ' ', v);
> end.

Well... I fail to see the improvement over old fashioned:

for i:=low(a) to high(a) do
   writeln(i,' ',a[i]);

Daniël


More information about the fpc-devel mailing list