Template:Ifnumber: Difference between revisions

Replacing documentation with transclusion from subpage
m (Formatting fix in documentation)
(Replacing documentation with transclusion from subpage)
 
(One intermediate revision by the same user not shown)
Line 1: Line 1:
<includeonly>{{#iferror: {{#expr: {{{1|}}}=0 }} | {{{3|}}} | {{{2|}}} }}</includeonly><noinclude>Checks if the first parameter results in a numeric value, for use in other templates. Copied from the [https://fr.wikisource.org/wiki/Mod%C3%A8le:Ifnumber French Wikisource] wiki.
<includeonly>{{#iferror: {{#expr: {{{1|}}}=0 }} | {{{3|}}} | {{{2|}}} }}</includeonly><noinclude>{{doc}}</noinclude>
 
Examples:
* '''<nowiki>{{ifnumber|3|yes|no}}</nowiki>''' -> {{ifnumber|3|yes|no}}
* '''<nowiki>{{ifnumber|This is not a number|yes|no}}</nowiki>''' -> {{ifnumber|This is not a number|yes|no}}
 
The other parameters are optional:
* '''<nowiki>{{ifnumber|3||no}}</nowiki>''' -> {{ifnumber|3||no}}
* '''<nowiki>{{ifnumber|3|yes}}</nowiki>''' -> {{ifnumber|3|yes}}
* '''<nowiki>{{ifnumber|This is not a number||no}}</nowiki>''' -> {{ifnumber|This is not a number||no}}
* '''<nowiki>{{ifnumber|This is not a number|yes}}</nowiki>''' -> {{ifnumber|This is not a number|yes}}
[[Category:Templates]]
</noinclude>