Jason & Merav wrote

> Hi,
> 
> I want create 100 variables called 'var1', 'var2' .... 'var100'.
> 
> my handler currently reads :
> 
> on doit
> repeat with i = 1 to 100
> "var"&i = 0
> end repeat
> end
> 
> but Lingo doesn't like the fact that my code is trying to set a string ...
> not a variable. Is there a way to do this!!!!
> 
> Thanks you,


You can do what you want with

  do ("var"&i & " = integer(0)")

You would also need to declare all one hundred variables as globals.

But you are much much much better off using a list. For example

global gList 

on doIt
  gList = []
  repeat with j = 1 to 100
   gList[j] = 0
  end repeat
end 

... then to get the value of the 13th entry, do this

put gList[13]

... and to set the value of the 13th entry

gList[13] = "something new"

Lists are amazingly useful and powerful. Better than sliced bread!

Luke



--
Mecca Medialight Pty Ltd

Mecca Medialight:                       Medialight Sound Studio:
111 Moor Street                         1 Bakehouse Lane
Fitzroy, Vic. 3065                      North Fitzroy, Vic. 3068
Tel +613 9416 2033                      Tel +613 9416 2033
Fax +613 9416 2055                      Fax +613 9416 2055

www.medialight.com.au
__________________________________________________________________________





[To remove yourself from this list, or to change to digest mode, go to
http://www.penworks.com/LUJ/lingo-l.cgi  To post messages to the list,
email [EMAIL PROTECTED]  (Problems, email [EMAIL PROTECTED])
Lingo-L is for learning and helping with programming Lingo.  Thanks!]

Reply via email to