goofy question about "repeat for each"

hh hh at hyperhh.de
Mon Mar 25 22:11:54 EDT 2019


> 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





More information about the use-livecode mailing list