Boolean logic: AND, OR and NOT
Every decision a computer makes eventually boils down to true or false. Three simple gates — AND, OR and NOT — are enough to build all of it.
Part of your national curriculum
- Algorithms and programming: Understand simple Boolean logic and some of its uses in circuits and programming
Lesson overview
What you'll learn in this lesson
Understand simple Boolean logic and some of its uses in circuits and programming
Key learning points
- • The three basic gates
- • Logic in programming
- • Logic in circuits
This lesson at a glance
- 25 minutes
- 14 parts to scroll through
- 3 quick checks
- Marked quiz at the end
- Gentle pace: short sittings with pauses
Words to know
Scroll down — the lesson carries on below
Watch & discover
Part 1 of 14
Watch first
Boolean logic: AND, OR and NOT
See how AND, OR and NOT gates let a computer make a decision.
In a nutshell
Understand simple Boolean logic and some of its uses in circuits and programming
Learning cycle
Part 2 of 14
Learning cycle 1 of 2
Part 1 · The three basic gates
A short piece of teaching, then a check to make sure it has landed.
Explore the idea
Part 3 of 14
Learn
The three basic gates
AND is only true when both inputs are true. OR is true when at least one input is true. NOT simply flips a value: true becomes false. A truth table for AND with inputs A and B: 0&0=0, 0&1=0, 1&0=0, 1&1=1 — only the last row is true.
Explore the idea
Part 4 of 14
Learn
Logic in programming
In code, `if raining AND cold: wear coat` only fires when both conditions hold. `if raining OR windy: take umbrella` fires if either is true. Programmers combine these to build precise conditions, such as `age >= 13 AND age <= 18` to spot teenagers.
Quick check
Part 5 of 14
Quick check
What does an AND gate output when both inputs are true?
Reset break
Part 6 of 14
Pause
That's sitting 1 of 2 done
Stretch, get a drink, look out of the window. There is no timer and nothing is counting down — your place is saved, so you can come back in five minutes or tomorrow.
Quick check
Part 7 of 14
Quick check
Which condition matches 'if raining OR windy: take umbrella'?
Learning cycle
Part 8 of 14
Learning cycle 2 of 2
Part 2 · Logic in circuits
A short piece of teaching, then a check to make sure it has landed.
Explore the idea
Part 9 of 14
Learn
Logic in circuits
Physical logic gates are tiny electronic circuits inside a chip. An AND gate's output wire only carries current when both input wires do. Millions of these gates wired together let a processor add numbers, compare values and make decisions.
Quick check
Part 10 of 14
Quick check
What does a NOT gate do to a true input?
Challenge round
Part 11 of 14
Game · Sort it
Which of these are true?
Drag each card into the right column. Tap a card first if dragging is fiddly.
True
Not true
Challenge round
Part 12 of 14
Game · Fill the gaps
Finish the sentences
Choose the word that belongs in each gap.
Physical logic gates are tiny electronic ____ inside a chip.
Mastery quiz
Part 13 of 14
Marked quiz
End of lesson quiz: Boolean logic: AND, OR and NOT
3 questions, marked with the reasoning shown. No timer.
1. What does an AND gate output when both inputs are true?
2. Which condition matches 'if raining OR windy: take umbrella'?
3. What does a NOT gate do to a true input?
Lesson round-up
Part 14 of 14
Lesson round-up
Ready when you are
Quiz score
Not sat
Games
Not played
Points this lesson
0
Best run
0 in a row
Luna: 0 out of 3 on the practice checks. Only if you feel up to it — one more?
Ask LunaDo the work
Your written work for this lesson
This is the part you'd do in your book at school. Pick the pieces below, write here or on paper, and photograph anything you draw or work out.
How a supermarket checkout knows the price
When a barcode is scanned, the checkout does not store the price itself. It sends the barcode number to a database and reads back a record: product name, price, whether it needs an age check. The record is the single place the price lives, so changing one row changes every till in the shop at once.
Problems come from bad data, not bad scanners. If two products share a barcode, or a price update reaches the shop overnight but the till holds an old copy in its cache, customers are charged the wrong amount. Shops check this with test transactions: scan a known item, expect a known price, record what actually happened.
Good systems also log every scan. If a customer complains, the log shows exactly which record was used and when.
Written for Good Learning Co.
Reading questions
- Write in your own words what the checkout sends and what it receives back.
- Explain one way bad data could cause a wrong price, and how logging helps find it.
- Design a test table with four tests for a new checkout, with expected and actual results.
Reading and notes
ReadingRead the lesson text again and note the key terms and how each one is used, in your own words — as you would for revision.
Half a page of notes
Extended writing
WritingExplain a real system that uses this idea — how it works, where it can go wrong, and how you would make it safer or better.
250–350 words
Algorithm on paper
DiagramWrite your steps out as pseudocode or a flowchart before you type anything, then photograph it.
1 flowchart or 10 lines
Code write-up
WritingCopy your code in, then explain underneath what each part does and what you had to fix.
Code + 5 sentences
Test table
Working outMake a test table: what you tried, what you expected, what actually happened.
4–6 tests
Saved as you type.
Part 1 of 14 · Watch & discover
How this is going
- Not looked at yet
Understand simple Boolean logic and some of its uses in circuits and programming
