Difference between revisions of "Template:IsEven"
From PlantUse English
MarcBrugman (Talk | contribs) (Created page with "<includeonly>{{#vardefine: data|{{{1}}}}}{{#vardefine: dec|{{#expr:{{#var:data}}/2}} }}{{#vardefine:trunk|{{#expr:trunc{{#var:dec}}}} }}{{#ifeq:{{#var:dec}}|{{#var:trunk}}|true|}...") |
GerdSchmidt (Talk | contribs) |
||
(2 intermediate revisions by one other user not shown) | |||
Line 1: | Line 1: | ||
− | <includeonly>{{#vardefine: data|{{{1}}}}}{{#vardefine: dec|{{#expr:{{#var:data}}/2}} }}{{#vardefine:trunk|{{#expr:trunc{{#var:dec}}}} }}{{#ifeq:{{#var:dec}}|{{#var:trunk}}|true|}} | + | <includeonly>{{#vardefine: data|{{{1}}}}}{{#vardefine: dec|{{#expr:{{#var:data}}/2}} }}{{#vardefine:trunk|{{#expr:trunc{{#var:dec}}}} }}{{#ifeq:{{#var:dec}}|{{#var:trunk}}|true|}}</includeonly><noinclude> |
− | </includeonly> | + | |
− | <noinclude> | + | |
== Template to test if a number is even or not == | == Template to test if a number is even or not == | ||
=== Parameters : === | === Parameters : === | ||
the number to test | the number to test | ||
− | + | returns true if even, false if not | |
=== Exemple === | === Exemple === | ||
− | <nowiki>{{IsEven|1}}</nowiki> returns {{ | + | <nowiki>{{IsEven|1}}</nowiki> returns {{IsEven|1}} |
− | <nowiki>{{IsEven|21}}</nowiki> returns {{ | + | <nowiki>{{IsEven|21}}</nowiki> returns {{IsEven|21}} |
− | <nowiki>{{IsEven|42}}</nowiki> returns {{ | + | <nowiki>{{IsEven|42}}</nowiki> returns {{IsEven|42}} |
[[category:Template]] | [[category:Template]] | ||
</noinclude> | </noinclude> |
Latest revision as of 09:56, 1 June 2011
Template to test if a number is even or not
Parameters :
the number to test returns true if even, false if not
Exemple
{{IsEven|1}} returns {{IsEven|21}} returns {{IsEven|42}} returns true