|
|||||
|
|||||
Related Syntax | |||||
Integer data type |
You can use the integer data type to store and manipulate integer values between -2,147,483,648 to 2,147,483,647. In a future version of OmniMark, integers will become unbounded, so you should avoid writing code which depends on the current size limit of integers or on the wrapping of values which occurs when you exceed the maximum or minimum values of an integer. For instance, in current OmniMark, the expression 2,147,483,647 + 10
gives the result -2147483639. In a future version it will give the result 2147483657.
Integer data type formatting lets you move the decimal place, change the padding from blanks to zeros, or suppress trailing zeros.
If you need to write code that depends on the specific behavior of 32-bit integers, or if you need to represent a 32-bit bit field, you should use the int32 data type.
Integers are automatically initialized to 0.
You can initialize integer variables when you declare them:
global integer quantity initial {0}
You can set the value of an integer to the value of a numeric literal, another integer, the result of an integer expression, or a stream expression or literal string that evaluates to an integer value:
set quantity to 5 set quantity to number-of-things set quantity to number-of-children * apples-per-child set quantity to form-data{"quantity"} set quantity to "27"
You can use the following operators with integers:
+
-
*
/
modulo
increment
decrement
<
>
<=
>=
=
!=
%
mask
union
difference
complement
shift
See data type conversion for information on how to convert from integer to other data types and vice versa.
For information on how to represent hex numbers, octal numbers and others in which you convert a string to a number, see base
.
Related Syntax global, local, constant |