AND operator (logical)

Returns a TRUE value if each logical expression is TRUE.

Syntax

expression AND expression
expression
An expression that evaluates to a logical value (TRUE or FALSE).

Example

This procedure lists all customers with credit limits between two values (supplied by the user and stored in the variables low-credit and hi-credit). The expressions Customer.CreditLimit >= low-credit and Customer.CreditLimit <= hi-credit are logical expressions because each yields a true or false value. Using the AND operator to join these logical expressions results in a logical expression that follows the WHERE keyword.

r-and.p

DEFINE VARIABLE low-credit LIKE credit-limit LABEL "Low Credit Limit".
DEFINE VARIABLE hi-credit  LIKE credit-limit LABEL "High Credit Limit".

REPEAT:
  SET low-credit hi-credit WITH FRAME cr-range.
  FOR EACH Customer NO-LOCK WHERE
    (Customer.CreditLimit >= low-credit) AND 
    (Customer.CreditLimit <= hi-credit):
    DISPLAY Customer.CustNum Customer.Name Customer.CreditLimit.
  END.
END.

See also

NOT operator (logical), OR operator (logical)