Comparison (Boolean) Operators
Boolean expressions yield the boolean values TRUE, FALSE, or (with nullable expressions) null. 4GL includes the logical operators AND, OR, and NOT, and the following comparison operators:
With null, the result of a comparison will be true, false, or null. The result of a comparison (except for a comparison of reference variables) is null when one or both operands of the expression are null.
In 4GL, the if and while statements and the where clause of query statements test the results of boolean expressions. For example, assume that status is a character field on a form. Whenever the boolean expression “status = 'n' ” is TRUE, the following statement calls the NewProject frame:
if status = 'n' then
callframe NewProject;
endif;
In
if
and while statements, if the result of an expression is null, the flow of control occurs exactly as if the boolean expression evaluates to FALSE
. For examples, see
Nulls in Expressions (see
Nulls in Expressions).
Reference variables may be compared, but only for equality, inequality, is null, or is not null. When comparing two reference variables that both contain null for equality (or inequality), the result is TRUE or FALSE, not null. Similarly, when comparing two reference variables only one of which contains null for equality, the result is FALSE.