Difference between revisions of "Template:IsEven"

From PlantUse English
Jump to: navigation, search
 
(One intermediate revision 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
return true if even, false if not  
+
returns true if even, false if not  
 
=== Exemple ===
 
=== Exemple ===
 
<nowiki>{{IsEven|1}}</nowiki> returns {{IsEven|1}}
 
<nowiki>{{IsEven|1}}</nowiki> returns {{IsEven|1}}

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