Language Elements and Reference:xpplrm

Logical operators Foundation

All logical operators execute logical operations and return logical values. There is one unary logical operator and two binary operators. The unary logical operator performs negation. There are two syntaxes that can be used for it. The table below lists all logical operators:

Logical operators
Operator Type Data type Operation
.NOT. unary L logical negation
! unary L logical negation
.AND. binary L logical And
.OR. binary L logical Or

The operands of the logical operators must be of the logical data type, which means they must result in the value .T. (true) or .F.(false). The following code shows various combinations of operands for logical operators and the results of the operations:

? .NOT. (.T.)               // result: .F. 
? ! (.F.)                   // result: .T. 
? (.T.) .AND. (.T.)         // result: .T. 
? (.F.) .AND. (.T.)         // result: .F. 
? (.F.) .AND. (.F.)         // result: .F. 
? (.T.) .AND. (.F.)         // result: .F. 
? (.T.) .OR.  (.T.)         // result: .T. 
? (.T.) .OR.  (.F.)         // result: .T. 
? (.F.) .OR.  (.T.)         // result: .T. 
? (.F.) .OR.  (.F.)         // result: .F. 

Feedback

If you see anything in the documentation that is not correct, does not match your experience with the particular feature or requires further clarification, please use this form to report a documentation issue.