[fpc-devel] for-in-index loop

Alexander Klenin klenin at gmail.com
Fri Jan 25 20:24:38 CET 2013


On Sat, Jan 26, 2013 at 6:11 AM, Sven Barth <pascaldragon at googlemail.com> wrote:
> I think he also means things like (without critizing):

Yes, thank for a dose of sanity :)

Few more examples, taken from just one standard package:

while Node.NextBrother<>nil do begin
  ...
  Node:=Node.NextBrother;
end;

while Node<>nil do begin
  ...
  Node:=Node.Next;
end;

while Node<>nil do begin
  ...
  Node:=Node.NextSibling;
end;

while Result<>nil do begin
  ...
  Result:=Result.NextError;
end;

> MyDataSet.First;
> while not MyDataset.Eof do begin
>   // ...
>   MyDataSet.Next;
> end;
> // on a sidenote: what about a TDataSet enumerator? :)

It is not clear what should loop variable contain:
for v in MyDataSet do ... -- what is v?

--
Alexander S. Klenin



More information about the fpc-devel mailing list