Jump to content
Sign in to follow this  
mexykanu

Declaring variables with incremental names?

Recommended Posts

mexykanu

Hi,

Can anyone tell me if it's possible to declare variables with incremental names during a loop ?

I'm talking about something like:

For $i=1 to 5

dim $var & $i

Next

This would declare $var1, $var2, $var3, $var4, $var 5.

Thank you,

mex.

Edited by mexykanu

Share this post


Link to post
Share on other sites
Dampe

Study how arrays work, then use this.

For $i = 1 to 5 Step 1
    Local $var[$i]
Next

Share this post


Link to post
Share on other sites
mexykanu

That was it :). Thank a lot for your help and time

Share this post


Link to post
Share on other sites
mexykanu

Hi again,

The variable i needed was not meant to be infinite, so this was the solution

dim $var[10]

For $i=1 to $myvar

$var[$i]=Other Stuff

Next

Where $myvar is somewhere between 2 and 7-8. $var[10] was bigger just to be sure

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.