The problem with the for in loop is that I need the index.
I'm sometimes searching through the stringlist looking for a match, and when I
find a match, I want to read the value
And then do a break, because there is no point is searching once I found what I
am looking for:
For I:= 0 to MyStringlist.high Do
Begin
If MyStringlist[I].Names = SearchName Then
Begin
MyValue := MyStringlist[I].ValueFromIndex;
Break;
End;
End;
I agree that the for - in loop is a great way if you are always processing the
entire list and don't need the index for anything.
James
_______________________________________________
fpc-pascal maillist - fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal