Scripting what should be a simple loop...

Bob Sneidar bobs at twft.com
Mon Jul 12 11:05:32 CDT 2010


Just one gotcha with the repeat for each construct. Do NOT under any circumstances change the contents of the source variable inside the repeat loop. For instance:

repeat for each line tLine in myListOfLines

Do NOT change the contents of myListOfLines inside your repeat loop. It was explained to me some time ago that Revolution accesses the memory of this variable directly and "parses" it somehow, hence the speed at which it works, so changing it will almost certainly return very unexpected results. 

Bob


On Jul 10, 2010, at 4:16 AM, David C. wrote:

> To which Mark S. added:
>> David and Mark,
>> 
>> Yet, repeat for each rules. Whether using arrays is faster than using regular
>> variables depends on whether your repeat loop is written smartly.
> 
> Thanks guys. Since I basically just finished rebuilding most of the
> app, I'll keep that info in mind for my future projects and/or perhaps
> yet another revision for this one at some point.




More information about the use-livecode mailing list