Template:IfNumber
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 |