Template:Int

From LIMSWiki
Revision as of 16:31, 31 October 2013 by Shawndouglas (talk | contribs) (Created as needed.)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigationJump to search

0

[edit] [purge] Template documentation

Usage

This template is used to determine if an argument is a number or not. If it is a number, then ‘1’ or, if provided, the second parameter is returned. Otherwise, ‘0’ or the third parameter is returned.

Template parameters

ParameterDescriptionTypeStatus
test value1

the argument to be tested

Stringrequired
true return value2

what to display if the first argument is a number

Default
0
Stringoptional
false return value3

what to display if the first argument is not a number

Default
1
Stringoptional

Examples

code result
{{Int|a}}

0

{{Int|1}}

1

{{Int|1.0}}

1

{{Int|1.1}}

1

{{Int|1|a number|not a number}}

a number

{{Int|1.0|a number|not a number}}

a number

{{Int|1.1|a number|not a number}}

a number

{{Int|1/2|a number|not a number}}

a number

{{Int|1/1|a number|not a number}}

a number

{{Int|1e3|a number|not a number}}

a number

{{Int|1e-3|a number|not a number}}

a number

{{Int|0.1e3|a number|not a number}}

a number

See also