|
Web+ Tutorial
|
Lesson 2.6 - Resolving Ambiguities in Variable Names
- Description
It is possible for several variables with the same name to be included in your scripts. For example, you may write a script which contains a statement setting the value of the variable x. A user running your script might then submit a different value for x in a form. To distinguish between different variables of the same name, you can use the following prefixes with your variable names. If two or more of the above exist and you use #VariableName# with no prefix, it will return the value of the variable appearing higher in the following chart.
- Agument
- /tutorial/argument/arg37.wml
- Example
- Sample
<ul> <webPrint> <li>You are looking at lesson #lesson#. <webSet #lesson# = 12345> <li>Now the value of <code>Variables.lesson</code> is #Variables.lesson#. <li>And the value of <code>URL.lesson</code> is #URL.lesson#. <li>The value of <code>lesson</code> is #lesson#. </webPrint> </ul>
- Result:
- Exercise
-
You can try out some Web+ code of your own here.
|
|