Logical Operators

You use the logical operators And, Or, Xor, Eqv, and Imp to perform two kinds of operations:

  • Bitwise

    Compares the bits in the binary representation of two numeric values and returns a new number derived from that comparison.

    For example:

    ' Calculate the logical product of binary 10 and 11
    ' and display the result in binary representation.
    Print Bin$(2 And 3)
    ' Output: 10
  • Boolean

    Tests the truth value of a two-operand expression and returns a value of True (-1), False (0), or NULL. LotusScript® compares the bits in the binary representation of the truth values for each operand and returns a value derived from that comparison.

    For example:

    Dim anInt% As Integer
    anInt% = 5
    Print (anInt% > 2) And (anInt% < 10)  
    ' Both operands are True.
    ' Output: True
    Print CInt((anInt% > 2) And (anInt% < 10))
    ' Output: True
    Print CInt(True And True)
    ' Output: True

You use the logical operator Not to perform the same sorts of operations on expressions consisting of a single operand. Not reverses the values of the bits in the binary representation of its operand.

For example:

Print Bin$(Not 3)
' Output: 11111111 11111111 11111111 11111100
Print Bin$(Not False)
' Output: 11111111 11111111 11111111 11111111
Print (Not True)
' Output: 0