Concatenation of variables(not the contents) to make a varia

May 20, 2013 at 04:14:42
Specs: Windows 7
I am writing a long script for two weeks ago and now due to the way whose it's written, I need to define a variable name by concatenation of two existing variable names. I don't want to concatenate the contents of these variables but the variables themselves to make a new variable.
That may sound ridicule, but given the situation, I have no other choice. Is it possible? Thank you for your understanding.

See More: Concatenation of variables(not the contents) to make a varia

Report •

#1
May 20, 2013 at 06:02:43
Hard to tell without seeing your script.

=====================
M2 Golden-Triangle


Report •

#2
May 20, 2013 at 06:32:58
param2="something"
param3="something else"

Function open(id)
param=param&id
End Function

Instead of calling the 'open' function which concatenates the values; depending on the id parameter value, i'd to construct on the fly param2 and param3 above_written.

I don't know if I am clear? Thank for your help


Report •

#3
May 20, 2013 at 12:40:46
. . . And why aren't you using arrays? Or some other container data type?

How To Ask Questions The Smart Way


Report •

Related Solutions

#4
May 20, 2013 at 14:38:18
@Razor: Good question.

Anyway, this might work:
Function open(id)
param=eval("param"+Ltrim(cstr(id)))
'or if you don't need to "soften up" the content of "id"
param=eval("param"&id)
End Function


Report •

#5
May 21, 2013 at 07:09:54
Since you didn't even bother responding to pm,
when someone answers your question, mark it as solved.
http://www.computing.net/answers/pr...

Report •

Ask Question