Dplvar: Difference between revisions
Content added Content deleted
imported>FrozenPlum m (add purgenote) |
imported>FrozenPlum m (Prior issue requiring {{purgenote}} seems to have resolved, remove it) |
||
Line 1: | Line 1: | ||
{{purgenote}} |
|||
{{DPL manual|section=dplvar}} |
{{DPL manual|section=dplvar}} |
||
Revision as of 03:22, 2 October 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.