Clearing local variables

Devin Asay devin_asay at
Mon May 2 11:21:34 EDT 2016

> On Apr 29, 2016, at 9:17 AM, Mark Waddingham <mark at> wrote:
> On 2016-04-29 04:30, Kay C Lan wrote:
>> On Thu, Apr 28, 2016 at 11:47 PM, Mark Waddingham <mark at> wrote:
>>> From 7.0 onwards, this causes no problem as the engine takes a 'copy' of
>>> the target variable at the start of the loop. (Note you only pay for that
>>> copy when you mutate tList subsequently, and that mutation has no effect on
>>> the repeat for each loop being performed).
>>> Oh, so if your repeat script works now in LC 7/8 it comes with a Mark W
>> guarantee that it'll work in the future. ;-) Cool!
>> Does that mean the 'Important' note in the LC 8 Dictionary entry for
>> 'repeat' isn't so Important any more?
>> Important: In any of the for each loops, you should not change the
>>> labelVariable or container in a statement inside the loop. Doing so will
>>> not cause a script error, but will almost certainly produce unexpected
>>> results.
> Yes! That note should probably be replaced by one which says you can modify the target variable in the loop, but it won't have an effect on what is being repeated over. (I'm sure there's a better way to express that).

I’ll add that to the dictionary entry.


Devin Asay
Office of Digital Humanities
Brigham Young University

More information about the Use-livecode mailing list