Repeat loop index

Trevor DeVore lists at mangomultimedia.com
Mon Jul 14 10:26:01 EDT 2003


On 7/14/03 Jim Lyons wrote

>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?

What I do is set i to 1 before the loop starts and then at the end of my repeat loop statements I put "add 1 to i".  That way you keep track of what iteration you are on but you get the speed of the repeat for each.  At least that is my theory.  I haven't done time comparisons.

Trevor DeVore
Blue Mango Multimedia
trevor at mangomultimedia.com



More information about the use-livecode mailing list