updating the knowledge base

This commit is contained in:
2026-01-01 01:42:17 +00:00
parent edbbabcf78
commit 53f279f7d6
7 changed files with 152 additions and 1 deletions

39
20260101011126-xor.org Normal file
View File

@@ -0,0 +1,39 @@
:PROPERTIES:
:ID: F32F8F09-3DEC-4FD1-8CFA-401A316E906B
:END:
#+title: xor
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).