Integer
This keyword declares an integer variable where the value is within the range from -2^31 to 2^31-1.
Syntax
Local Integer NAME
Local Integer NAME(DIMENSIONS)
Variable Integer NAME(DIMENSIONS)
Value Integer NAME(DIMENSIONS)
Const Integer NAME(DIMENSIONS)
NAME
is the name of the variable declared.DIMENSIONS
can be:- A single numeric value DIM, meaning that you have an array with an index range from 0 to DIM-1.
- A range of numeric values INDEX1..INDEX2 where the index varies between INDEX1 and INDEX2.
- Several indexes or index ranges separated by a comma for multiple dimension arrays, and up to four dimensions.
You can do several variable declarations on the same line, separated by a comma.
Local declarations create the variables in the current local variable class that is not seen by nested or calling subprograms. The Call / Subprog and func / Funprog insulate the local variables, as well as the calls of method by fmet.
Const, Variable, and Value declarations state the arguments sent by a Call, func, or fmet. With these syntaxes, you can omit the dimensions and the index ranges when the parenthesis are present. The calling program defines the dimension and index ranges.
Example
# Direct declarations
Local Integer MYDISTANCE, MYAGE : # Local integer variables
Local Integer VALUES(1..1024) : # An array of 1024 integer values
# A sub-program sending integers and returning a result
Funprog SEND_INTEGERS(MYINT)
Variable Integer MYINT(,) : # A 2 dimensions matrix of integers is sent as reference
...
End SEND_STATUS
# A sub-program storing integers
Subprog STORE_VALUES(LEVEL)
Value Integer LEVEL(1..20) : # An array of 20 elements is sent (a copy is done when passing the arguments)
...
End
Comments
There is still a Global declaration variable that exists for variables that must be seen in the scope of a process execution, but its use is strongly discouraged.
Implicit data type conversion
The Integer data type will implicitly convert Tinyint, Shortint, Float, Double and Decimal to an Integer. For Decimal, Float and Double precision numbers the decimal portion of the number is truncated then the integer portion is assigned to the Integer under the constraints that the integer portion of Integer is limited to -2^31 to 2^31-1.
...
Local Integer MY_INTEGER # Declare Integer
MY_INTEGER = 78956.23 # Float, Double or Decimal conversion - MY_INTEGER = 78956
...
See also
Global, Local, Variable, Value, Const, Tinyint, Date, Shortint, Float, Double, Decimal, Char, Clbfile, Blbfile, Uuident, Datetime, Instance.