:PROPERTIES:
:ID:       F32F8F09-3DEC-4FD1-8CFA-401A316E906B
:END:
#+title: xor
#+filetags: :maths:notes:

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:

#+begin_src python
  a = True
  b = False
  result = a ^ b  # result will be True
#+end_src  

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).
  
