Boolean algebra, which could be used in programming to express logical operations, defines a set of operations on the values and .
Boolean Expression
A boolean expression involves a boolean operator and one or more operands. Each boolean expression implies a value of true or false. The most common Boolean operators are (∧), (∨), and (¬).
X
Y
X AND Y
F
F
F
F
T
F
T
F
F
T
T
T
X
Y
X OR Y
F
F
F
F
T
T
T
F
T
T
T
T
X
NOT X
F
T
T
F
In a boolean expression involving more than one operator, the operator has the highest precedence, followed by and . May use parentheses to avoid any ambiguity.
Truth Tables for Boolean Functions
A boolean function receives boolean inputs and produces a boolean output. A boolean table lists all possible combinations of inputs and the corresponding output of a Boolean function.
X
Y
Z
Y OR Z
X AND (Y OR Z)
X AND Y
X AND Z
(X AND Y) OR (X AND Z)
†For convenience, you could use 1 for T and 0 for F.