Hi guys

A question that I have had for a long time:

Suppose I have the variable

list:TStringList

and I want to iterate through the items through the items in list.

Between the construction:

For i := 0 to list.Count - 1 do
begin;
  commands
end;

And the construction

j := list.Count - 1;
For i := 0 to j do
begin;
   commands
end;

Which would be the most efficient?

I ask because I have the impression that in the first construction it will
be necessary to generate code to determine the value list.Count - 1 at each
iteration of the For loop.

Greetings from São Paulo - Brazil

Arí Ricardo
-- 
_______________________________________________
lazarus mailing list
lazarus@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus

Reply via email to