goofy question about "repeat for each"

Jerry Jensen jerry at jhjensen.com
Mon Mar 25 22:31:56 EDT 2019


My mistake. Thanks for the correction.
.Jerry

> On Mar 25, 2019, at 7:11 PM, hh via use-livecode <use-livecode at lists.runrev.com> wrote:
> 
>> Jerry J. wrote:
>> "Starting in version 7.0 it is possible to modify the container
>> variable inside a for each loop without affecting the iterations
>> of the loop."
>> 
>>> jbv wrote:
>>> repeat for each line j in cc
>>>  add 1 to item 1 of j
>>>  put return & j after var2
>>> end repeat
> 
> You can't change the *iterator variable* (above j), which is *always*
> readable only.
> [The (modifiable) *container variable* is in the example above cc.]
> 
> This works, as already indicated.
> 
> repeat for each line j in cc
>  if the num of items of j > 1 then
>    put return & (1+item 1 of j, item 2 to -1 of j) after var2
>  else put return & 1+item 1 of j after var2
> end repeat
> 
> 
> _______________________________________________
> 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