Sign in to follow this  
Followers 0
KeitaroUrashimaSan

Variable in a Variable?

4 posts in this topic

#1 ·  Posted (edited)

I started this because the search will not alow the string "variable in variable". What I want to know is if it is possible to call to a variable in another variable.

For Example I have several strings in many variables and I want to call to each variable by using a one set variable. I hope this makes sense and that this is the right way to do this. the text in the [] brackets is what I need help with

;variables
dim $num
dim $first
dim $CountLines = 0

;data
$myVariable1 = "string"
$myVariable2 = "string"
$myVariable3 = ""

;count strings
$first = "myVariable"
$num = 0
$myVariable = [$first + $num]

While $myVariable <> ""
$num =+ 1
$countLines =+ 1
$myVariable = [$first + $num]
;I want it to add a number to myVariable and then get the string from myVariable1, then increment that number to 2 and so on
WEnd
Edited by KeitaroUrashimaSan

Share this post


Link to post
Share on other sites



maybe..

;variables
dim $num
dim $first


;data
$myVariable1 = "Dave"
$myVariable2 = "John"
$myVariable3 = ""

;count strings
$first = "myVariable"
$num = 0
$myVar = ($first & $num)

While $myVar <> ""
$num += 1
$myVar = Eval($first & $num );I want it to add a number to myVariable
        ;and then get the string from myVariable1, then                     ;increment that number to 2 and so on
    MsgBox(0x0,"test", $myVar, 2)
WEnd

8)


NEWHeader1.png

Share this post


Link to post
Share on other sites

I added the Eval statement and it works well now 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