Template:IfNumber

Revision as of 23:07, 25 April 2024 by Auron956 (talk | contribs) (Template to check if parameters are numbers or not)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Tests if the value of the first parameter is a number or not. If the parameter is a number, then the second parameter is returned (default: 1), otherwise the third parameter is returned (default: 0)

Examples

Code Result
{{IfNumber|7}} 1
{{IfNumber|seven}} 0
{{IfNumber|e}} 0
{{IfNumber|seven|Is a number|Is not a number}} Is not a number
{{IfNumber|7|Is a number|Is not a number}} Is a number