cc does not change. j only changes in each iteration when you add 1 to item 1 of j. Next iteration j will be set to the next line in cc.
LC History: It used to be when repeat for each was first implemented, you were playing with fire to change the content of either cc or j, as the repeat for each construct actually indexed the memory holding cc. Changing cc could (and usually did) force the OS to make another copy of cc SOMEWHERE ELSE in memory, thereby releasing the prior handle (if I understand correctly), and depending on whether or not the OS overwrote the memory that once contained cc, the contents could be anything. Since then it's been reworked so that doesn't happen. Bob S > On Mar 25, 2019, at 12:31 , jbv via use-livecode > <use-livecode@lists.runrev.com> wrote: > > Hi list, > > I have a list of values such as : > 540,20 > 542,22... > one per line in a variable named cc. > > Now I'm running the following loop : > repeat for each line j in cc > add 1 to item 1 of j > put return & j after var2 > end repeat > > goofy question : does each iteration of the loop > change the values of each line of cc, or does it > only change the value of j ? _______________________________________________ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode