Difference between revisions of "Template:MaybeVar"
Jump to navigation
Jump to search
Kevin Wang (talk | contribs) (Created page with "<includeonly>{{#if:{{{1|}}}|{{#if:{{#var:{{{1}}}}}|{{#var:{{{1}}}}}|{{{1}}}}}|0}} </includeonly><noinclude> {{Template doc| Given an argument, return either the contents of t...") |
Kevin Wang (talk | contribs) m |
||
| (One intermediate revision by the same user not shown) | |||
| Line 1: | Line 1: | ||
| − | <includeonly>{{#if:{{{1|}}}|{{#if:{{#var:{{{1}}}}}|{{#var:{{{1}}}}}|{{{1}}}}}|0}} </includeonly><noinclude> | + | <includeonly>{{#if:{{{1|}}}|{{#if:{{#var:{{{1}}}}}|{{#var:{{{1}}}}}|{{{1}}}}}|{{{2|0}}}}} </includeonly><noinclude> |
{{Template doc| | {{Template doc| | ||
| − | Given an argument, return either the contents of the variable or echo - default to 0. | + | Given an argument, return either the contents of the variable or echo - default to arg2 or 0. |
<pre> | <pre> | ||
{{#vardefine:x|100}} | {{#vardefine:x|100}} | ||
| − | {{MaybeVar|x}}, {{MaybeVar}}, {{MaybeVar|y}}, {{MaybeVar| | + | {{MaybeVar|x}}, {{MaybeVar}}, {{MaybeVar||2}}, {{MaybeVar|y}}, {{MaybeVar|10}} |
</pre> | </pre> | ||
{{#vardefine:x|100}} | {{#vardefine:x|100}} | ||
| − | {{MaybeVar|x}}, {{MaybeVar}}, {{MaybeVar|y}}, {{MaybeVar| | + | {{MaybeVar|x}}, {{MaybeVar}}, {{MaybeVar||2}}, {{MaybeVar|y}}, {{MaybeVar|10}} |
}}</noinclude> | }}</noinclude> | ||
Latest revision as of 18:39, 14 December 2025
Template documentation
Given an argument, return either the contents of the variable or echo - default to arg2 or 0.
{{#vardefine:x|100}}
{{MaybeVar|x}}, {{MaybeVar}}, {{MaybeVar||2}}, {{MaybeVar|y}}, {{MaybeVar|10}}
100 , 0 , 2 , y , 10