At 12:52 30.10.2000 +0000, Leon McComish wrote:
>Hey gang,
>
>Anybody know if I can concatenate variable names like strings? I have a
>large number of variables (ball1, ball2, ball3 etc) and am trying to
>optimise my code. I can set a temp variable to a number (eg x=1, x=2 etc)
>and want to create the 1st variable from this.

Yep, this can be done using the 'do' which allows to run strings as lingo 
input. If youre variables are globals you could add properties to 'the 
globals' as an alternative.

However, I wouldn't advise to do so. That sort of task is what list are 
made for. Instead of countless balln - variables you could have a single 
list LBalls with all the values as its items.

After that you can exchange

theball = ball3

with

theBall = LBalls[3]

or even

ballOffset = ballOffset + 1
theBall = LBall[ballOffset]

which could do a lot in optimizing your code's maintainability.

Best regards
Daniel Plaenitz

[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