Eqv (operator)

Syntax Expression1 Eqv expression2
Description Performs a logical or binary equivalence on two expressions.
Comments If both expressions are either Boolean , Boolean variants, or Null variants, then a logical equivalence is performed as follows:
If the first expression is and the second expression is then the result is
TRUE TRUE TRUE
TRUE FALSE FALSE
FALSE TRUE FALSE
FALSE FALSE TRUE
If either expression is Null , then Null is returned.
Binary Equivalence If the two expressions are Integer, then a binary equivalence is performed, returning an Integer result. All other numeric types (including Empty variants) are converted to Long and a binary equivalence is then performed, returning a Long result. Binary equivalence forms a new value based on a bit-by-bit comparison of the binary representations of the two expressions, according to the following table:
1 Eqv 1 = 1 Example
0 Eqv 1 = 0 5 01101001
1 Eqv 0 = 0 6 10101010
0 Eqv 0 = 1 Eqv 00101000
Example This example assigns False to A, performs some equivalent operations, and displays a dialog box with the result. Since A is equivalent to False, and False is equivalent to 0, and by definition, A = 0, then the dialog box will display "A is False."
Sub Main()
  a = False
  If ((a Eqv False) And (False Eqv 0) And (a = 0)) Then
    MsgBox "a is False."
  Else
    MsgBox "a is True."
  End If
End Sub
See Also Operator Precedence (topic); Or (operator); Xor (operator); Imp (operator); And (operator).