Repeat loop index

Klaus Major klaus at major-k.de
Mon Jul 14 10:16:00 EDT 2003


Hi Jim,

> It was pointed out recently that it is much faster, especially for
> increasingly large amounts of text, to "repeat for each line of 
> theText"
> than "repeat with i=1 to the number of lines of theText". But what if
> you need to know what line you're on in the loop? Do you have to use 
> the
> slower form?

Nope :-)

Just add these 2 lines to know what line your on

...
put 0 into your_line_counter
repeat for each line ...
   add 1 to your_line_counter
   ## do your ultra-fast stuff here...
...

So you can always do something with this var inside the loop...

Hope that helps.

> TIA,
> Jim Lyons
> Tallahassee, Florida, USA

Regards

Klaus Major
klaus at major-k.de
www.major-k.de




More information about the use-livecode mailing list