Template:Ifnumber: Difference between revisions
Jump to navigation
Jump to search
m (Switching documentation to inline code tags for styling) |
(Replacing documentation with transclusion from subpage) |
||
Line 1: | Line 1: | ||
<includeonly>{{#iferror: {{#expr: {{{1|}}}=0 }} | {{{3|}}} | {{{2|}}} }}</includeonly><noinclude | <includeonly>{{#iferror: {{#expr: {{{1|}}}=0 }} | {{{3|}}} | {{{2|}}} }}</includeonly><noinclude>{{doc}}</noinclude> | ||
</noinclude> |
Latest revision as of 21:02, 29 June 2023
Checks if the first parameter results in a numeric value, for use in other templates. Copied from the French Wikisource wiki.
Examples:
{{ifnumber|3|yes|no}}
-> yes{{ifnumber|This is not a number|yes|no}}
-> no
The other parameters are optional:
{{ifnumber|3||no}}
->{{ifnumber|3|yes}}
-> yes{{ifnumber|This is not a number||no}}
-> no{{ifnumber|This is not a number|yes}}
->
Template Data
Returns the second parameter if the first parameter is numeric, and the third parameter if it's not.
Parameter | Description | Type | Status | |
---|---|---|---|---|
Value to check | 1 | The value that is checked for whether or not it's numeric. | Line | required |
Output if numeric | 2 | The returned value if the first parameter is numeric. | Content | suggested |
Output if not numeric | 3 | The returned value if the first parameter is NOT numeric. | Content | suggested |