AND
The AND
operator
is the logical intersection operator.
Syntax
bool-expr AND bool-expr
- bool-expr is a boolean expression.
Usage
The AND
operator is used to perform a logical conjunction on two boolean
expressions.
Possible values of the operands are
TRUE
, FALSE
and
NULL
. If one of the operands is NULL
, the logical
AND
expression evaluates to NULL
or FALSE
,
depending on the value of the second operand:
- The result of
AND
isTRUE
, if both operands areTRUE
. - The result of
AND
isFALSE
, if one of the operands isFALSE
and the other operand isTRUE
,FALSE
orNULL
. - The result of
AND
isNULL
, if one of the operands isNULL
and the other operand isNULL
orTRUE
.
By default, the runtime system evaluates both operands on the left and right side of the
AND
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
FALSE
. 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 256!=257 AND 257==257 THEN
DISPLAY "This line should display"
END IF
END MAIN