17,230
edits
(Created page with "<onlyinclude>{{#vardefineecho:{{{1}}}|{{#expr:{{#var:{{{1}}}}}-1}}}}</onlyinclude> ==Purpose== This template slightly simplifies the common task of decrementing a variable. I...") |
(incorporated enhancements from ++ (pre-decrement or null return options)) |
||
Line 1: | Line 1: | ||
<onlyinclude>{{# | <onlyinclude>{{#ifeq:{{{2|}}}|pre|{{!!=|{{{1}}}|0}}}}{{#vardefine:{{{1}}}|{{#expr:{{#var:{{{1}}}}}-1}}}}{{#if:{{{2|}}}||{{#var:{{{1}}}}}}}</onlyinclude> | ||
==Purpose== | ==Purpose== | ||
Line 7: | Line 7: | ||
{{Usage|name}} | {{Usage|name}} | ||
{{Usage/Param|name|The name of the variable (without #var syntax).}} | {{Usage/Param|name|The name of the variable (without #var syntax).}} | ||
To return the variable ''pre-decrement'', use: {{Usage|name|pre}} | |||
To not return the variable, use: {{Usage|name|no}} | |||
{{Cat|Utility Templates}} | {{Cat|Utility Templates}} |