Can I have a double dollar sign?
Moderator: Forum Moderators
Forum rules
- Please use [code] BBCode tags in your posts for embedding WML snippets.
- To keep your code readable so that others can easily help you, make sure to indent it following our conventions.
Can I have a double dollar sign?
I suppose not, but I ask.
If I have a variable that stores the name of another variable, can I insert the value of the variable of which the name is stored?
Example:
(say i=5)
{VARIABLE_OP var_x format temp[$i].x}
then $var_x will put in the following: temp[5].x , but I want the value of this variable.
Actually, at this example you don't need it, but I alreayd have made some constructs where it would have been useful.
If I have a variable that stores the name of another variable, can I insert the value of the variable of which the name is stored?
Example:
(say i=5)
{VARIABLE_OP var_x format temp[$i].x}
then $var_x will put in the following: temp[5].x , but I want the value of this variable.
Actually, at this example you don't need it, but I alreayd have made some constructs where it would have been useful.
First read, then think. Read again, think again. And then post!
In 1.1.7 or higher you can use $| to get a dollar sign.
Before that it is tricky if you want to delay substitution.
If it is OK to expand things right away you can just stack up $s and there will be multiple substitutions until they are all used up. This is done right to left so that subscripts for arrays will be replaced before the array reference is substituted.
Before that it is tricky if you want to delay substitution.
If it is OK to expand things right away you can just stack up $s and there will be multiple substitutions until they are all used up. This is done right to left so that subscripts for arrays will be replaced before the array reference is substituted.