We're sorry but this app doesn't work properly without JavaScript enabled. Please enable it to continue.

This lesson's interactive features are locked, please to keep using them

Exclusive or (XOR)

The "exclusive or" operator is very important in cryptography.

XOR, or "exclusive or" operates on binary data. It returns true if both of its inputs are opposites (one false and one true), otherwise, it returns false. You may see the operator written this way: .

Interactive example available with JavaScript enabled.

Assignment

Write a function xor() that takes two boolean values as input and returns the result of the "exclusive or" operation.