Template:Ifnumber: Difference between revisions

From 118Wiki
Jump to navigation Jump to search
m (Formatting fix in documentation)
m (Switching documentation to inline code tags for styling)
Line 2: Line 2:


Examples:
Examples:
* '''<nowiki>{{ifnumber|3|yes|no}}</nowiki>''' -> {{ifnumber|3|yes|no}}
* <code><nowiki>{{ifnumber|3|yes|no}}</nowiki></code> -> {{ifnumber|3|yes|no}}
* '''<nowiki>{{ifnumber|This is not a number|yes|no}}</nowiki>''' -> {{ifnumber|This is not a number|yes|no}}
* <code><nowiki>{{ifnumber|This is not a number|yes|no}}</nowiki></code> -> {{ifnumber|This is not a number|yes|no}}


The other parameters are optional:
The other parameters are optional:
* '''<nowiki>{{ifnumber|3||no}}</nowiki>''' -> {{ifnumber|3||no}}
* <code><nowiki>{{ifnumber|3||no}}</nowiki></code> -> {{ifnumber|3||no}}
* '''<nowiki>{{ifnumber|3|yes}}</nowiki>''' -> {{ifnumber|3|yes}}
* <code><nowiki>{{ifnumber|3|yes}}</nowiki></code> -> {{ifnumber|3|yes}}
* '''<nowiki>{{ifnumber|This is not a number||no}}</nowiki>''' -> {{ifnumber|This is not a number||no}}
* <code><nowiki>{{ifnumber|This is not a number||no}}</nowiki></code> -> {{ifnumber|This is not a number||no}}
* '''<nowiki>{{ifnumber|This is not a number|yes}}</nowiki>''' -> {{ifnumber|This is not a number|yes}}
* <code><nowiki>{{ifnumber|This is not a number|yes}}</nowiki></code> -> {{ifnumber|This is not a number|yes}}
[[Category:Templates]]
[[Category:Templates]]
</noinclude>
</noinclude>

Revision as of 19:57, 21 September 2021

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}} ->