even, odd, whole
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
Non-numeric values (including dates) are passed through without modifications. This is particularly suitable in combination with vectorization in order
to pass through blank contents, explanatory text, etc.
Vectorization: This function supports vectorization in the 1st function parameter.
Instead of providing a single value, you can provide a set or even a nested set which contain multiple values.
The function will then process every value and its return value contains a corresponding set containing all results.
Indirect parameter passing is disabled
Vectorization is allowed in the 1st function parameter
1
No. | Type | Description |
---|---|---|
1 input |
numeral set |
Value Input value or a set containing numerals to check (vectorization). |
Type | Description |
---|---|
boolean set |
Result true if criteria is met. Multiple values are returned in a set if vectorization has been made use of. |
Value provided is not a numeral
a[] = { 1, 1.5, 2, 3, 4. -1, -1.5, -2 };
for all( a[], p[] )
{
print(p[],": is ");
if (even (p[])) print ("even, ");
if (odd (p[])) print ("odd, ");
if (whole(p[])) print ("whole, ");
echo;
}
echo("Vectorization example: ", whole(a[]) );
1: is odd, whole,
1.5: is
2: is even, whole,
3: is odd, whole,
3: is odd, whole,
-1.5: is
-2: is even, whole,
Vectorization example: {true,false,true,true,true,false,true}