Menu

Boolean Logic

OR gate

OR is a logic gate with two inputs and one output. It gives an output of 1 when either input is 1, or when both inputs are 1. The only time an OR gate outputs 0 is when both of its inputs are 0.

An OR gate drawn with inputs A and B and output A OR B, beside its truth table where every row except 0 0 gives an output of 1.

Truth table for an OR gate

ABA OR B
000
011
101
111

Read each row across: only the top row has two 0 inputs, so it is the only row with an output of 0. The other three rows each contain at least one 1, so each output is 1.

Inclusive OR

An OR gate uses inclusive OR. In everyday speech, "or" can mean one thing or the other but not both. In Boolean logic, A OR B is true when at least one of A and B is true, and it is still true when both are true.

For example, a security light comes on if its movement sensor (M) detects someone OR its manual switch (S) is on. If both happen at once, the light still comes on, so M OR S is true.

OR is written as A OR B, where A and B are the two inputs.

Practise this