BOOLEAN data type provides a simple Boolean type. A variable or the BOOLEAN data type can acquire the following values:
1, which stands for TRUE
0, which stands for FALSE
NULL
This data type can be used in Boolean expressions and in other cases when either true or false result is required.
The values can be assigned to such kind of value in three different ways:
Method |
Example |
Restrictions |
Assigning a whole number |
LET bool_var = 1 LET bool_var = 0
|
You cannot assign any other numbers either whole or fractional except 1 and 0 |
Assigning specific keywords |
LET bool_var = NULL LET bool_var = FALSE |
The only keywords that can be assigned to a Boolean variable are TRUE, FALSE, and NULL |
Assigning values during input |
|
You can print either 1 or 0 for the BOOLEAN value, no other characters are allowed |
The value of a BOOLEAN variable is stored in the form of integer either 1 or 0. However, if this variable is used in a comparison or in any 4GL expression, you can use either of the ways described above. e.g.:
DEFINE bool_v BOOLEAN
…
IF bool_v = TRUE THEN
…
END IF
IF bool_v = 0 THEN
…
END IF