Difference between revisions of "Logical Operators"

From Recital Documentation Wiki
Jump to: navigation, search
 
Line 5: Line 5:
 
!Operator||Operation
 
!Operator||Operation
 
|-
 
|-
|.AND.||Logical AND
+
|.AND./AND||Logical AND
 
|-
 
|-
 
|AND||Logical AND
 
|AND||Logical AND
Line 35: Line 35:
  
 
# Statements enclosed in parentheses  
 
# Statements enclosed in parentheses  
# .NOT./!
+
# NOT,!
# .AND.
+
# AND
# .OR., .XOR.
+
# OR, XOR
  
  

Revision as of 14:30, 24 March 2009

The Recital/4GL supports the following Logical Operators:


Operator Operation
.AND./AND Logical AND
AND Logical AND
.OR. Logical OR
OR Logical OR
.NOT. Logical NOT
! Logical NOT
.XOR. Logical Exclusive OR
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.