Definition: |
integer identifier
-- or -- integer i = integer(object x) |
Description: |
This serves to define the integer type. You can also call it like an ordinary function to determine if an object is an integer. |
Comments: |
When invoked as a function, returns 1 if x is an integer, otherwise returns 0.
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. |
Example 1: |
integer z z = -1 |
Example 2: |
if integer(y/x) then puts(SCREEN, "y is an exact multiple of x") end if |
See Also: | atom, sequence, string, object, floor, Core Language |
