Notifications
Clear all

[Closed] Construct variable name from 2 strings

 vij

a=“auto”
b=“desk”

Now how do I create another variable with name ‘autodesk’ using variable a and b.

6 Replies

newVar = a + b

 vij

thats not what Im looking for really…

I need a variable named autodesk to be created using a and b. your variable is named newVar.

you should look into EXECUTE

execute(a + b + ” = 10″);

would execute “autodesk = 10” and create a variable named autodesk caring the 10 value

As a side question, why does it matter what the variable is called?

I often found when I was learning scripting that each time I reached for the execute function that there was something fundamentally wrong with my program flow or logic. – in almost every singe case there was a much better way to do things.

HI, you can try:

(
a=“auto”
b=“desk”
execute (a+b+”=5″) – create a variable
format “% = %
” (a+b) (execute (a+b))
)

True. Have you looked at storing your variables in a struct, or array?