\<bookmark_value\>Eqv operator (logical)\</bookmark_value\>

Eqv Operator

Calculates the logical equivalence of two expressions.


Result = Expression1 Eqv Expression2


\<emph\>Result:\</emph\> Any numeric variable that contains the result of the comparison.

\<emph\>Expression1, Expression2:\</emph\> Any expressions that you want to compare.

When testing for equivalence between Boolean expressions, the result is \<emph\>True\</emph\> if both expressions are either \<emph\>True\</emph\> or \<emph\>False\</emph\>.

In a bit-wise comparison, the Eqv operator only sets the corresponding bit in the result if a bit is set in both expressions, or in neither expression.


Sub ExampleEqv
Dim A As Variant, B As Variant, C As Variant, D As Variantsee #i38265
Dim vOut As Variant
    A = 10: B = 8: C = 6: D = Null
    vOut = A > B Eqv B > C REM returns -1
    vOut = B > A Eqv B > C REM returns 0
    vOut = A > B Eqv B > D REM returns 0
    vOut = (B > D Eqv B > A) REM returns -1
    vOut = B Eqv A REM returns -3
End Sub

Please support us!