Sign in to follow this  
Followers 0
aommaster

Naming a variable depending on another variable

3 posts in this topic

#1 ·  Posted (edited)

Hey guys!

I'm trying to create a simple guessing game (I have nothing better to do :)), and what I'd like to have is a variable named according to the values of the variables in the for loop I am used.

E.g.:

For $i=0 to $max-1

$varname=guictrl.......

Next

The $varname should take the value of the $i.

So, the first control will be assigned a value of 0, then the next one, 1, etc.

Is there a way of doing it?

Edited by aommaster

Share this post


Link to post
Share on other sites



Hey guys!

I'm trying to create a simple guessing game (I have nothing better to do :)), and what I'd like to have is a variable named according to the values of the variables in the for loop I am used.

E.g.:

For $i=0 to $max-1

$varname=guictrl.......

Next

The $varname should take the value of the $i.

So, the first control will be assigned a value of 0, then the next one, 1, etc.

Is there a way of doing it?

Look up Assign in the helpfile. It would be easier to use arrays though.

Share this post


Link to post
Share on other sites

Look up Assign in the helpfile. It would be easier to use arrays though.

Fantastic! Thanks!

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0