Skip to content

Eqv operator

Used to perform a bitwise equivalence on two expressions --- the logical inverse of Xor.

Syntax:

result = expression1 Eqv expression2

result
Any numeric variable.
expression1, expression2
Any expressions.

If either expression is Null, result is also Null. When neither expression is Null, result is determined according to the following table:

If expression1 isAnd expression2 isThe result is
TrueTrueTrue
TrueFalseFalse
FalseTrueFalse
FalseFalseTrue

The Eqv operator performs a bitwise comparison of identically positioned bits in two numeric expressions and sets the corresponding bit in result according to the following table:

If bit in expression1 isAnd bit in expression2 isThe result is
001
010
100
111

INFO

Eqv always evaluates both operands.

Example

This example uses the Eqv operator to perform logical equivalence on two expressions.

vb
Dim A, B, C, D, MyCheck
A = 10: B = 8: C = 6: D = Null    ' Initialize variables.
MyCheck = A > B Eqv B > C         ' Returns True.
MyCheck = B > A Eqv B > C         ' Returns False.
MyCheck = A > B Eqv B > D         ' Returns Null.
MyCheck = A Eqv B                 ' Returns -3 (bitwise comparison).

See Also

twinBASIC and LOGO copyright of "WaynePhillipsEA" author