Logical Operators

From Recital Documentation Wiki
Revision as of 14:31, 24 March 2009 by Yvonnemilne (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

The Recital/4GL supports the following Logical Operators:


Operator Operation
.AND. / AND Logical AND
.OR. / OR Logical OR
.NOT./ NOT Logical NOT
! Logical NOT
.XOR. / XOR Logical Exclusive OR


If SET OPTLOG or the environment variable DB_OPTLOG are enabled, statements containing Logical Operators are automatically optimized in the following way:

If the Left Hand Side (LHS) of an AND statement is false, then the Right Hand Side (RHS) is parsed, but not evaluated.

If the LHS of an OR statement is TRUE, then the RHS is parsed, but not evaluated.

The above optimizations can be disabled, causing all entries with the statement to be evaluated, if DB_OPTLOG and SET OPTLOG are disabled.

The Logical Operators are evaluated from left to right in the following order:

  1. Statements enclosed in parentheses
  2. NOT,!
  3. AND
  4. OR, XOR


Example

? .T. and .F. or .T.
.T.