Template:Int

From Everything Wiki
Jump to navigation Jump to search
0.00
(0 votes)

0

Usage[edit]

<templatedata>{ "description": "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.", "params": {

 "1": {
   "label": "test value",
   "description": "the argument to be tested",
   "type": "string",
   "required": true
 },
 "2": {
   "label": "true return value",
   "description": "what to display if the first argument is a number",
   "type": "string",
   "default": "0",
   "required": false
 },
 "3": {
   "label": "false return value",
   "description": "what to display if the first argument is not a number",
   "type": "string",
   "default": "1",
   "required": false
 }

}}</templatedata>

Examples[edit]

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[edit]


This page was moved from enwikibooks:en:Template:Int. Its edit history can be viewed at Template:Int/edithistory


You are not allowed to post comments.