Jump to content
Sign in to follow this  
lemony

Is it possible to combine 2 variable names to create a new variable?

Recommended Posts

lemony

Hey guys,

Here is what I am trying to do:

$var1 = "red"
$var2 = "green"
$var3 = "apple"

$var1 & $var3 = "YES"
$var2 & $var3 = "NO"

MsgBox(0, "Is it red?", $redapple)
MsgBox(0, "Is it green?", $greenapple)

My code above does NOT work. But it shows you what I am trying to accomplish.

Basically, I want to create the variables $redapple and $greenapple by combining $var1 with $var3, and $var2 with $var3

Is this possible?

Edited by lemony

Share this post


Link to post
Share on other sites
lemony

It's funny. I search the forum and help file for hours and don't find anything that helps.

But right after I start the topic I do one more search and boom, the answer is there. LOL.

So for anyone else that may come across this topic, Assign() is the answer.

Share this post


Link to post
Share on other sites
=sinister=

You can make a variable euqal another variable.

$var1 = "YES
$var3 = $var1
$var2 = "NO"
$var3 = $var2

Not sure if thats what your asking.

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.