even, odd, whole

Prev Next

Function Names

even, odd, whole

Description

whole returns true if the number is a whole number
even returns true if the number is a whole number and even
odd returns true if the number is a whole number and odd

Call as: function

Restrictions

Indirect parameter passing is disabled

Parameter count

1

Parameters

No.TypeDescription
1
input
numeral Value

Value to check.

Return value

TypeDescription
boolean Result

true if criteria is met.

Exceptions

Value provided is not a numeral

Examples

      for all parameters( { 1, 1.5, 2, 3, -1, -1.5 }, p[] )
      {
          print(p[],": is ");
          if (even (p[])) print ("even, ");
          if (odd  (p[])) print ("odd, ");
          if (whole(p[])) print ("whole, ");
          echo;
      }

Output

1: is odd, whole,
1.5: is
2: is even, whole,
3: is odd, whole,
-1: is odd, whole,
-1.5: is
Try it yourself: Open LIB_Function_even.b4p in B4P_Examples.zip. Decompress before use.