18.3.1 integer
The integer-type is a basic data type that contains a numeric character in the range from -2,147,483,648 to +2,147,483,647. Data of this type cannot include any decimals and exponents.
The keyword integer allows you to declare integer-type variables and initialize variables and constants. You can use this keyword only in the DEFINE section. When you specify two or more variables after this keyword, use a comma (,) to delimit them.
You can declare a constant by using the keyword const in combination with the keyword integer. The values of the constants declared in the DEFINE section can only be referenced, and cannot be changed in the MAIN or ERROR section.
- Organization of this subsection
(1) Format
DEFINE { [const] integer variable_name1 [= integer_constant1] [, variable_name2 [= integer_constant2] ]; }
(2) Example of coding
DEFINE { const integer OK_END = 0, NG_END = -1 ; // Enabled integer end_status, return_code; // Initialized at 0 }
(3) Notes
-
When you initialize variables or constants, you can specify only decimal values.
-
An integer-type variable can be assigned only a value of type integer, bool, or float. However, if a value of type float is assigned, because the value may become inaccurate, a warning message appears in the output window upon a syntax check.
-
All variables are initialized at 0 by default. In the example shown in (2) above, end_status and return_code are initialized at 0.