Page 1 of 1

And another thing...

Posted: Tue Nov 15, 2016 6:03 am
by RossG
I have some code which uses a loop

repeat with x = 10 to 50

after each loop I want numbers put into
a variable which includes x e.g. when x = 10

put Ones into "Ones" & x --- want it to go into variable Ones10

but LC gives me a "bad destination" for all the combinations and
variations I've tried. Of course the combination/variation I haven't
tried yet is the one that works!

Why does the ratio of works:doesn't work always have to be 1:100?

Help appreciated.

Re: And another thing...

Posted: Tue Nov 15, 2016 6:12 am
by dunbarx
Hi.

In order to create and load variables on the fly, I usually do something like this. Make a button. In its script:

Code: Select all

 on mouseUp
   repeat with y = 1 to 10
      do "put y * 2 into onTheFlyVar" & y
      breakPoint
   end repeat
end mouseUp
This creates ten "named" variables, and loads them with values of twice the index. Just an example.

Write back with your own offerings.

Craig

EDIT.

Add breakpoint to see development of each new variable.