How to use an array to solve the following...

Bob Sneidar bobs at twft.com
Tue Feb 21 16:36:50 EST 2012


You are probably right, I imagined in my mind that when the engine parses the chunk, it had to already be in memory, as in a variable or array. Since the thing being parsed was a statement that evaluated to something, it seemed that the engine would have nothing in existence to parse to begin with, and would have to create it. I suppose then that upon evaluating the repeat for each statement the first time, it would create a temporary place in memory inaccessible to the code, which would cease to exist once the repeat loop was done. 

I can see other functions and commands would have to do something similar, evaluating a statement, as in put line (the number of lines of myvar) of myVar , but the value of the number of lines of myVar must cease to exist once the statement was evaluated. In the repeat for each loop, the value would have to be retained while the repeat loop ran, and then purged when it was done. It's odd to think like that, but the repeat for each command *might* be written this way. I suppose it would have to be. 

Bob
 

On Feb 21, 2012, at 12:34 PM, Richard Gaskin wrote:

> Bob Sneidar wrote:
> 
> > Repeat for each line x in the keys of array y would seem at a glance
> > to have to reevaluate the keys of <array> each time through the loop,
> > wouldn't it? You must mean you get the keys first in a variable and
> > then use that.
> 
> If I understand how the engine treats that, it seems that it gets the keys only once up front, since anything used with "repeat for each" is considered unchangeable during the repeat.
> 
> --
> Richard Gaskin
> Fourth World
> LiveCode training and consulting: http://www.fourthworld.com
> Webzine for LiveCode developers: http://www.LiveCodeJournal.com
> LiveCode Journal blog: http://LiveCodejournal.com/blog.irv
> 
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode





More information about the use-livecode mailing list