[Lazarus] Easiest way to "case" strings
Marc Weustink
marc.weustink at cuperus.nl
Thu Mar 26 14:07:40 CET 2009
Alexander Klenin wrote:
> 1) Iterating over array property, where and item should be stored in a
> temporary variable
> to avoid rereated calls to GetItem method inside the loop iteration:
> var
> i: integer; item: TItem;
> ...
> for i := 0 to obj.ItemCount do begin
> item := Items[i];
> ... item ... item ...
> end;
>
> versus
>
> var
> item: TItem;
> ...
> for item in obj.Items do begin
> ... item ... item ...
> end;
>
> the latter is safer, simpler and more clear code.
ehm, what if I want it reversed ?
and how should the compiler know that there are Count items ?
Marc
More information about the Lazarus
mailing list