Binary Through Conditionals
Conditionals can be shown through binary numbers as well. In many instances, programmers refer to the binary number 0 as false, and the binary number 1 as true. This is also used in the transistors of computers. Binary logic is not just used for number logic, but it is also used to tell true and false. A recap of conditionals:
-
AND: 1 and 1 = 1 1 and 0 = 0 0 and 0 = 0
-
OR: 1 or 1 = 1 1 or 0 = 1 0 or 0 = 0
-
EXCLUSIVE-OR 1 xor 1 = 0 0 xor 0 = 0 1 xor 0 = 1
A note about XOR: In case the pattern was clear, XOR is a conditional in where it returns true if both parts are true and false, or false and true, but returns false when both parts are true or both parts are false.