Xor

From NSB App Studio
Jump to navigation Jump to search

result = x Xor y

Description

Xor returns the logical, exclusive disjunction of two expressions. result is TRUE, if and only if one of the expressions x and y evaluate to TRUE, otherwise, result is FALSE.

Example

// Xor Example
/* Xor performs exclusive disjunctions */

var Test1, Test2, x, y;
x = 2;
y = 9;
Test1 = ((x > 0) ^ (y < 10)) == 1;
Test2 = ((x > 0) ^ (y > 10)) == 1;
NSB.Print("Logical:");
NSB.Print("  (x > 0) Xor (y < 10) = " + Test1.toString());
NSB.Print("  (x > 0) Xor (y > 10) = " + Test2.toString());

Rem Xor Example
'Xor performs exclusive disjunctions

Dim Test1, Test2, x, y
x = 2
y = 9
Test1 = (x > 0) Xor (y < 10)
Test2 = (x > 0) Xor (y > 10)
Print "Logical:"
Print "  (x > 0) Xor (y < 10) = " & CStr(Test1)
Print "  (x > 0) Xor (y > 10) = " & CStr(Test2)

Output

Logical:
  (x > 0) Xor (y < 10) = False
  (x > 0) Xor (y > 10) = True

Related Items

And, Eqv, Imp, Not, Or