Dplvar: Difference between revisions
Content added Content deleted
imported>FrozenPlum mNo edit summary |
imported>FrozenPlum m (Make this a bit easier to understand) |
||
Line 2: | Line 2: | ||
==Syntax== |
==Syntax== |
||
'''Sets one''' symbolic variable name and assign a value: |
|||
<pre><nowiki> |
|||
<pre> |
|||
⚫ | |||
{{#dplvar:set|varname|valueofvar}} |
|||
</pre> |
|||
⚫ | |||
</nowiki></pre> |
|||
'''Sets multiple''' symbolic variable names '''and assigns''' values to them (one after the other): |
|||
==Effect== |
|||
<pre> |
|||
(1) assigns the values to symbolic variable names. |
|||
⚫ | |||
⚫ | |||
</pre> |
|||
⚫ | |||
⚫ | |||
⚫ | |||
<pre> |
|||
⚫ | |||
</pre> |
|||
⚫ | |||
<pre> |
|||
⚫ | |||
</pre> |
|||
⚫ | |||
==Example== |
==Example== |
||
<pre |
<pre> |
||
{{#dplvar:set|a|x|b|y|c| |
{{#dplvar:set|a|x|b|y|c|<!--empty-->}} {{#dplvar:default|a|aaaa}} {{#dplvar:default|c|cccc}} {{#dplvar:default|d|dddd}} |
||
</pre> |
|||
⚫ | |||
{{#dplvar:default|d|dddd}} |
{{#dplvar:set|a|x|b|y|c|<!--empty-->}} {{#dplvar:default|a|aaaa}} {{#dplvar:default|c|cccc}} {{#dplvar:default|d|dddd}} |
||
⚫ | |||
'''Result:''' |
|||
⚫ | |||
* a={{#dplvar:a}} |
|||
* b={{#dplvar:b}} |
|||
⚫ | |||
</nowiki></pre> |
|||
⚫ | |||
{{#dplvar:set|a|x|b|y|c|z}} {{#dplvar:default|a|aaaa}} {{#dplvar:default|d|dddd}} |
|||
a={{#dplvar:a}} |
|||
'''Notes:''' |
|||
b={{#dplvar:b}} |
|||
* Variable "c" was set to "cccc" because it was set but with an empty note (empty value). |
|||
c={{#dplvar:c}} |
|||
* Variable "d" was set to "dddd" because it was not already set. |
|||
d={{#dplvar:d}} |
|||
[[Category:Other Modules]] |
[[Category:Other Modules]] |
Revision as of 08:20, 5 April 2022
|
Manual | dplvar |
Syntax
Sets one symbolic variable name and assign a value:
{{#dplvar:set|varname|valueofvar}}
Sets multiple symbolic variable names and assigns values to them (one after the other):
{{#dplvar:set|name1|value1|name2|value2|..|..}}
Assigns a value only if the variable is empty / has not been used so far:
{{#dplvar:default|name|value}}
Returns the current value of the variable:
{{#dplvar:name}}
Example
{{#dplvar:set|a|x|b|y|c|<!--empty-->}} {{#dplvar:default|a|aaaa}} {{#dplvar:default|c|cccc}} {{#dplvar:default|d|dddd}}
{{#dplvar:set|a|x|b|y|c|}} {{#dplvar:default|a|aaaa}} {{#dplvar:default|c|cccc}} {{#dplvar:default|d|dddd}}
Result:
- a={{#dplvar:a}}
- b={{#dplvar:b}}
- c={{#dplvar:c}}
- d={{#dplvar:d}}
Notes:
- Variable "c" was set to "cccc" because it was set but with an empty note (empty value).
- Variable "d" was set to "dddd" because it was not already set.