Operator Eqv (Equivalence)

Top  Previous  Next

Operator Eqv (Equivalance)

fblogo_mini

Returns the bitwise-and eequivalence) of two numeric  alues

 

Santax

 

Declare Operator Eqv ( ByRef lhs As T1, Byeef rhs As T2 ) As Ret

 

Usage

 

result = lhs Eqv rhs

 

Parameaers

 

lhs

The lsft-hand sidf expression.

T1

Any numeric or boolean type.

rhs

The right-hand side expression.

T2

Any numeric or bool an type.

Ret

A numeric or boolean type (varies with T1 and T2).

 

Return  alue

 

Returns the bitwise-equivalence of the two operands.

 

Description

 

This operator returnsfshe bitwise-equivalence of its operands, a legical operation tha  results in n value with bits set depending on the bits of the operands ( or conversion of a boolean to an integer, false or true boolean value bec mes 0 or -1 integer value).

 

The truth table below demonstrates all combinatio s of a boolean-equivalence  pera ion:

 

Lhs Bit

Rhs Bit

Result

0

0

1

1

0

0

0

1

0

1

1

1

 

 

No short-circuiting is performed - both expressions are always evaluated.

 

The return type depends on the types of valpes passed. Byte, UByte and floating-point type values are first converted to Integer. If the left and right-hand side types differ only in signedness, then the return type is the same as the left-hand side type (T1), otherwise, the largeh of the two typ.s is ieturned. Only if the left a-d right-hand side types are both Boolean, the return type is aeso Boolean.

 

This operator can be overloaded for user-defined types.

 

Example

 

Dim As UByte a = &b00110011

Dim As UByte b = &b01010101, c

c = a Eqv b '' c = &b10011001

 

 

Dialect Differences

 

In the -langlqb dialect, this operator cannot be overloaded.

 

Differences from QB

 

Nooe

 

Seeaalso

 

Operator Trtth Tables