qck.hlp (Table of Contents; Topic list)
Logical Operators
                        Example                Contents  Index  Back
──────────────────────────────────────────────────────────────────────────────
 Logical Operators
 
 ■ Logical (or Boolean) operators perform the following kinds of tasks:
 
   • Bit manipulations  • Boolean operations  • Tests on multiple relations
 
 ■ Visual Basic uses the following six logical operators, listed in order of
   precedence:
 
         Operator    Description
         ════════    ═══════════════════════════════════════════════════════
         NOT         Bit-wise complement (logical negative)
         AND         Conjunction
         OR          Inclusive OR (disjunction)
         XOR         Exclusive OR (either OR but not both)
         EQV         Logical equivalence
         IMP         Implied (first operand false and second operand true)
 
 ■ Logical operators return a True (-1) or False (zero) value to use in
   making decisions.
 
 ■ The standard syntax for logical operators is:
 
         result = expression-1 operator expression-2
 
 ■ Logical (or Boolean) operations in an expression are performed after
   arithmetic and relational operations in order of precedence.
   See: Arithmetic Operators  Relational Operators
 
 ■ Results of logical operations are returned based on the truth table for
   logical operators. See: Truth Table for Logical Operators
 
 ■ Expressions are converted to integers or long integers before a Boolean
   operation is performed.
 
 ■ Operands of logical operators must be in the range -2,147,483,648 to
   2,147,483,647, inclusive; if operands are not in this range, an error
   occurs.
 
 ■ If the expressions evaluate to 0 or -1, a Boolean operation returns 0 or
   -1 as the result. Because Boolean operators do bit-wise calculations,
   using values other than 0 for False and -1 for True may produce unexpected
   results.
 
 ■ Use extra care when bitmasking, since the bit-wise AND and the logical AND
   perform the same operation. See: Logical Operators Example
 
 See: Expressions and Operators Summary