OR
The OR
operator
is the logical union operator.
Syntax
bool-expr OR bool-expr
- bool-expr is a boolean expression.
Usage
The OR
operator is used to perform a logical disjonction on two boolean
expressions.
Possible values of the operands are
TRUE
, FALSE
and
NULL
. If one of the operands is NULL
, the logical
OR
expression evaluates to NULL
or TRUE
,
depending on the value of the second operand: - The result of
OR
isFALSE
, if both operands areFALSE
. - The result of
OR
isTRUE
, if one of the operands isTRUE
and the other operand isTRUE
,FALSE
orNULL
. - The result of
OR
isNULL
, if one of the operands isNULL
and the other operand isNULL
orFALSE
.
By default, the runtime system evaluates both operands on the
left and right side of the OR
keyword.
This is the traditional behavior of the Genero language, but
in fact the right operand does not need to be evaluated if the
first operand evaluates to TRUE
. This method
is called short-circuit evaluation, and can be enabled
by adding the OPTIONS SHORT CIRCUIT
clause at the
beginning of the module.
Example
MAIN
IF TRUE OR FALSE THEN
DISPLAY "This line should display"
END IF
END MAIN