Extension:Variables: Difference between revisions

Jump to navigation Jump to search
m
add one example, remove a part that read weird
No edit summary
m (add one example, remove a part that read weird)
Line 34: Line 34:


=== #var_final ===
=== #var_final ===
This function will output the final, last value a variable has at the end of the page rendering. Naturally, the value will be inserted after the parser went over the entire wiki markup, so this function can't be used in other functions, expecting the right value is being used. Example:
This function will output the final, last value a variable has at the end of the page rendering. Naturally, the value will be inserted after the parser went over the entire wiki markup, so this function can't be used in other functions. Example:


* <code><nowiki>{{#var_final:variablename|default}}</nowiki></code>
* <code><nowiki>{{#var_final:variablename|default}}</nowiki></code>
Line 45: Line 45:
Add one to ''n'':
Add one to ''n'':
* <code><nowiki>{{#vardefine:n|{{#expr:{{#var:n}}+1}}}}</nowiki></code>
* <code><nowiki>{{#vardefine:n|{{#expr:{{#var:n}}+1}}}}</nowiki></code>
Swap the value of two variables ''c'' and ''q'':
* <code><nowiki>{{#vardefine:c|{{#var:q}}{{#vardefine:q|{{#var:c}}}}}}


[[Category:Extension Docs]]
[[Category:Extension Docs]]
6,906

edits

Navigation menu