Help, what am I doing wrong???

Dennis Brown see3d at writeme.com
Sat Jul 30 15:13:06 EDT 2005


On Jul 30, 2005, at 12:59 PM, Jan Schenkel wrote:
>
> Hi Dennis,
>
> I believe this was largely due to modifying the
> control variable <inName1> within the repeat loop. I
> made some other changes, and you'll find the result
> below:

I guess I don't understand the repeat for each control structure they  
way I thought I did.
I wonder if the repeat for each variable is really a pointer to the  
original complete string that gets overwritten if you modify the  
variable.  In that case the repeat for each variable must be a read  
only value... or else!

But wait, there's more...  From the dictionary:

 >>"The for each element labelVariable in array form sets the  
labelVariable to the first element in the array at the beginning of  
the loop, then sets it to the next element for each iteration.

 >>  Important!  You cannot change the labelVariable in a statement  
inside the loop. Doing so will cause a script error..."

Well I never got that script error message!

I guess what they meant to say was that "You cannot change the  
CONTENTS OF THE labelVariable in a statement inside the loop. Doing  
so will cause YOU TO GO CRAZY TRYING TO DEBUG YOUR SCRIPT SINCE IT  
WILL WORK FINE IN DEBUG MODE"

>  repeat for each item inName1x in inNames1
>     put inName1X & "W" into inName1
>
> Running the above script seemed to work for me.

Right, because the inName1x variable is never modified.



More information about the use-livecode mailing list