- Hi, it's glad to see you again./
- Posts/
- The Surprising Difference Between Human 'Or' and Computer Logic/
The Surprising Difference Between Human 'Or' and Computer Logic
Did you know? The “or” we casually use in daily life means something different to computers.
For example, when someone asks you, “Do you want an apple or an orange?”
Our possible responses are usually limited to:
- Apple
- Orange
But for computers, “or” means “choose one or both unless there’s no choice”.
Using the example above, a computer’s possible answers would be:
- Apple
- Orange
- Both, please!
Expressed in a truth table, it looks like this:
A | B | A OR B |
---|---|---|
0 | 0 | 0 |
1 | 0 | 1 |
0 | 1 | 1 |
1 | 1 | 1 |
So, what’s the computer equivalent of our everyday “or”?
The answer is: XOR (eXclusive OR - for when you want to be fancy at parties)
A | B | A XOR B |
---|---|---|
0 | 0 | 0 |
1 | 0 | 1 |
0 | 1 | 1 |
1 | 1 | 0 |
"Do you want an apple OR an orange?" 🍎🍊
— Lester Lee (@techriverco) August 21, 2024
In computer logic, the answer could be both! Learn how computers interpret "or" differently from humans.