A few people gave you basically the same answer, and I'll give it to you again. If you have a need for something like this, what you really want is a list. Lists are one of the most powerful features of Lingo. Once you get your head around them, you will wonder how you were able to get by without them.

For what you want to do, you should really create a list which would have 25 elements, where each element of the list has the value of 150. This is easily done as follows:

myVariable = []   -- start off as an empty list
repeat with i = 1 to 25
   append(myVariable, 150)
end repeat

Then where ever you would have referenced something with a variable of yours like 'myVariableX', you would instead reference it with 'myVariable[x]'. For example where you would have tried to use myVariable5, use myVariable[5], referring to the 5th element in your list. This can be either on the left or right side of an assignment statement as it:

myVariable[5] = 12

or

someOtherVariable = myVariable[5]

But the real power of lists comes when you start to refer to list elements using other variables as indexes:

myVariable[someIndex] = someValue

I would strongly recommend that you take the time to learn about lists, it will be well work it.

Irv

At 10:06 PM -0400 5/28/05, George S. Roland wrote:
Hello to all,

I posted a similar question to this a few days ago, but from the answers I got, I realize that I didn't make my question clear. Sorry. I would like to try again.

I want to know if there is a way to use a repeat loop integer to name variables so that a large numer of variables could be set to a value.

For example, suppose I have a variable called "myVariable", and I want to initialize 25 of them to = 150, as in myVariable1 = 150, myVariable2=150...myVariable25=150.

So I want the repeat with loop to supply a unique number to each variable as in:

repeat with i = 1 to 25
   myVariable(i) = 150
end repeat.

Thanks,

George
[To remove yourself from this list, or to change to digest mode, go to http://www.penworks.com/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!]


--

Multimedia Wrangler.
[To remove yourself from this list, or to change to digest mode, go to 
http://www.penworks.com/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