Jump to content

Naming a variable depending on another variable


Recommended Posts

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
Link to comment
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.

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...