Files
vault/Career/Theory/XOR.md
Zaine 129ce1442b
Some checks failed
Build Quartz Notes / build (push) Failing after 20s
13
2026-07-13 09:16:09 +01:00

1.2 KiB
Executable File

note type, date, done
note type date done
theory
mathematics
2026-06-03 true

XOR stands for exclusive or. It is a logical operation that outputs true only when the inputs differ (one is true, the other is false). If both inputs are the same (both true or both false), the output is false.

Here is the truth table for XOR:

A B A XOR B
false false false
false true true
true false true
true true false

In programming, XOR is often represented by the caret symbol (^). For example, in many programming languages, you can use the XOR operator like this:

a = True
b = False
result = a ^ b  # result will be True

In simple terms it means "one or the other, but not both".

Some similar concepts include:

  • OR (inclusive or): Outputs true if at least one input is true.
  • AND: Outputs true only if both inputs are true.
  • NOT: Outputs the opposite of the input (true becomes false, false becomes true).
  • NAND: Outputs false only if both inputs are true (the opposite of AND).
  • NOR: Outputs true only if both inputs are false (the opposite of OR).
  • XNOR: Outputs true only when both inputs are the same (the opposite of XOR).