Course contentsShow
← Computer Science
Lesson 16 of 2,8721. Digital FoundationsFree lesson

The OR Gate

Learning the OR operation that outputs TRUE when at least one input is TRUE.

The OR Gate

What you'll learn: How the OR gate produces TRUE when at least one of its inputs is TRUE.

What Is an OR Gate?

An OR gate is a fundamental logic gate that takes two (or more) boolean inputs and outputs TRUE if any of those inputs is TRUE. It only outputs FALSE when all inputs are FALSE.

Think of it like a lightbulb controlled by two switches in parallel: flip either switch (or both) and the light turns on. Only when both switches are off does the light stay off.

The Truth Table

Here's how an OR gate behaves with two inputs (A and B):

ABOutput
FALSEFALSEFALSE
FALSETRUETRUE
TRUEFALSETRUE
TRUETRUETRUE

Notice that the output is TRUE in three out of four cases—whenever at least one input is TRUE.

Comparing to AND and NOT

You've already learned about AND and NOT gates:

  • NOT inverts a single input
  • AND requires both inputs to be TRUE
  • OR requires at least one input to be TRUE

The OR gate is more "permissive" than AND—it's easier to get a TRUE output because you only need one TRUE input instead of requiring all of them.

Real-World Example

Imagine a security system that triggers an alarm if either a door sensor OR a window sensor detects an intrusion. If the door opens (TRUE) OR the window opens (TRUE) OR both open (TRUE), the alarm sounds. The alarm only stays silent when both sensors report nothing (FALSE, FALSE).

Key Takeaway: The OR gate outputs TRUE when at least one input is TRUE, making it perfect for "either/or" logic scenarios.