[fpc-devel] Modernising Pascal

Jonas Maebe jonas at zeus.ugent.be
Wed Feb 23 14:12:32 CET 2005

On 23 feb 2005, at 14:04, Jamie McCracken wrote:

> My mistake it actually avoids initialising the loop variable rather 
> than not declaring it:
> for i in myarray do
>   myarray[i] := 0;
> as opposed to
> for i := low(myarray) to high (myarray) do
>    myarray[i] := 0;
> I think the for..in is much clearer and more compact (it works for 
> sets, arrays and other enumerated types)

I'm not sure whether it's that clear. In case of a set, I agree, but 
for an array it would seem more logical to me if i iterated over all 
values in the array, not over all indexes.


More information about the fpc-devel mailing list