Sign in to follow this  
Followers 0
mexykanu

Declaring variables with incremental names?

4 posts in this topic

#1 ·  Posted (edited)

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



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

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

Share this post


Link to post
Share on other sites

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  
Followers 0