Operator .AND. Foundation

.AND. Operator (binary): logical AND

Syntax
<lCondition1> .AND. <lCondition2>
Parameters
<lCondition>
<lCondition1> and <lCondition2> can be each any expression that returns a logical value.
Description

The .AND. operator links logical expressions and returns the result of a logical AND operation. This returns the value .T. (true) only when all .AND. linked expressions individually evaluate to the value .T. (true).

Many logical expressions can be linked with the .AND. operator. When one or more .AND. operators are used in a program line, the Xbase++ compiler usesshortcut optimizing by default. As soon as a single expression returns the value .F. (false), the result of the entire logical expression has been determined. Any remaining expressions are not evaluated and the result is the value .F. (false).

The shortcut optimizing can be turned off by the compiler switch /Z. If turned off, all expressions linked with .AND. are evaluated in a program line before the execution of the program continues.

Examples
The .AND. operator
// This example demonstrates use and results of the 
// .AND. operator 

PROCEDURE Main 

   ? .T. .AND. .T.                // result: .T. 
   ? .T. .AND. .F.                // result: .F. 
   ? .F. .AND. .T.                // result: .F. (Shortcut optimized) 
   ? .F. .AND. .F.                // result: .F. (Shortcut optimized) 

   ? IIf( 5<10 .AND. 5>1,"True","False") 
                                  // result: True 
RETURN 
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.