XOR Operator

Performs a logical Exclusive-Or combination of two expressions.

āļšāˇāļģāļš āļģāˇ“āļ­āˇ’āļē:


Result = Expression1 XOR Expression2

āļ´āļģāˇāļ¸āˇ’āļ­āˇ“āļąāˇŠ:

Result:āˇƒāļ‚āļšāļŊāļąāļēāˇš āļ´āˇŠâ€āļģāļ­āˇ’āļĩāļŊāļē āļ…āļŠāļ‚āļœāˇ” āˇ€āļą āļ•āļąāˇ‘āļ¸ āˇƒāļ‚āļ›āˇŠâ€āļēāˇāļ­āˇŠāļ¸āļš āˇ€āˇ’āļ āļŊāˇŠâ€āļēāļēāļšāˇŠ.

Expression1, Expression2: āļ”āļļāļ§ āˇƒāļ¸āˇŠāļļāļąāˇŠāļ° āļšāļģāˇ“āļ¸āļ§ āļ…āˇ€āˇāˇŠâ€āļē āļ•āļąāˇāļ¸ āˇƒāļ‚āļ›āˇŠâ€āļēāˇāļ­āˇŠāļ¸āļš āļ´āˇŠâ€āļģāļšāˇāˇāļąāļēāļąāˇŠ.

A logical Exclusive-Or conjunction of two Boolean expressions returns the value True only if both expressions are different from each other.

A bitwise Exclusive-Or conjunction returns a bit if the corresponding bit is set in only one of the two expressions.

āļ‹āļ¯āˇāˇ„āļģāļĢāļē:


Sub ExampleXOR
Dim vA As Variant, vB As Variant, vC As Variant, vD As Variant
Dim vOut As Variant
    vA = 10: vB = 8: vC = 6: vD = Null
    vOut = vA > vB XOR vB > vC ' returns 0
    vOut = vB > vA XOR vB > vC ' returns -1
    vOut = vA > vB XOR vB > vD ' returns -1
    vOut = (vB > vD XOR vB > vA) ' returns 0
    vOut = vB XOR vA ' returns 2
End Sub

Please support us!