Can I have a double dollar sign?

The place to post your WML questions and answers.

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.
Post Reply
toms
Posts: 1717
Joined: November 6th, 2005, 2:15 pm

Can I have a double dollar sign?

Post by toms »

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.
First read, then think. Read again, think again. And then post!
Xan
Inactive Developer
Posts: 258
Joined: August 28th, 2005, 3:05 pm
Contact:

Post by Xan »

Yes.
"It is time people learned about their failures and my successes."
bruno
Inactive Developer
Posts: 293
Joined: June 26th, 2005, 8:39 pm
Contact:

Post by bruno »

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.
Post Reply