Jump to content
Sign in to follow this  
aommaster

Naming a variable depending on another variable

Recommended Posts

aommaster

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
NELyon

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
aommaster

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  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.