-- or --
bool res = integer(object x)
This serves to define the integer type.
You can also call it like an ordinary function to determine whether an object is an integer.
When invoked as a function, returns 1 (true) if x is an integer, otherwise returns 0 (false).
On 32-bit, integers are whole numbers in the range -1,073,741,824 to +1,073,741,823 (-#40000000 to #3FFFFFFF, technically 31-bit)
On 64-bit, integers are whole numbers in the range -4,611,686,018,427,387,904 to +4,611,686,018,427,387,903 (-#4000000000000000 to #3FFFFFFFFFFFFFFF, technically 63-bit)
In phix, bool is a simple alias of integer. It does not validate that the value is 0 or 1 only - instead, 0 is false, any other value is deemed true. The builtin constants true and false can and should be used for variables and parameters declared as type bool, or, if you prefer, TRUE, True, FALSE, and False, are identical/aliases - mainly for compatibility with legacy code, but ultimately also one less thing (upper/lower case) that you have to remember, or fix.
integer z z = -1
if integer(y/x) then puts(1, "y is an exact multiple of x") end if
|See Also:||atom, sequence, string, object, floor, puts, Core Language|