You've met binary already — a computer is built from millions of tiny switches, each one on or off, which we write as 1 and 0. There is another way to read those same two states, and it is the key to this whole lesson. 1 can mean true; 0 can mean false. On is true, off is false. Suddenly the machine isn't just storing numbers — it's holding answers to yes-or-no questions.
Once a circuit can hold a true or a false, the next question is: can it combine them? If this is true and that is true, is the whole thing true? If either one is true, is it enough? Answering those questions — true and false, combined by simple rules — is called logic, and the tiny circuits that do it are called logic gates. A gate takes one or two inputs (each true or false) and gives back a single output (true or false), by a fixed rule. That is all a gate is.
Through this lesson, 1 = true = on and 0 = false = off. They are the same two states you met in binary, just read as answers rather than numbers. A logic gate is a circuit that takes true/false in and gives one true/false out.
This lesson builds directly on How computers represent data, where you met bits as 1s and 0s. The very same bits are at work here — only now we read 1 as true and 0 as false, and ask what happens when we combine them.
The simplest gate of all takes a single input and turns it into its opposite. If you put in true, it gives back false; put in false, it gives back true. It is called the NOT gate, and it does exactly what the word says: it gives you not what you put in. Think of a switch on a landing that reverses the light — NOT is that idea, in a circuit.
Every gate can be summed up in a small grid called a truth table. It lists every possible input and the output beside it. Because each input is only ever true or false, the table is always short. Here is the whole of NOT:
| In | Out |
|---|---|
| 0 | 1 |
| 1 | 0 |
Read each row left to right: "if the input is this, the output is that." The output column (here on the right, shaded) is the gate's answer. NOT simply swaps 0 and 1 — true becomes false, false becomes true.
You've met true, false, and your first gate. This short film shows the gates as real little circuits, switching as their inputs change. Watch for the moment an AND gate only lights up when both its inputs are on — the idea you're about to meet on the next page.
The next two gates each take two inputs. The AND gate is strict: its output is true only when both inputs are true. Think of a microwave that runs only when the door is shut and the start button is pressed — both, or nothing. The OR gate is generous: its output is true when either input is true (or both). Think of a light with two switches — flip either one and the light comes on.
| A | B | Out |
|---|---|---|
| 0 | 0 | 0 |
| 0 | 1 | 0 |
| 1 | 0 | 0 |
| 1 | 1 | 1 |
| A | B | Out |
|---|---|---|
| 0 | 0 | 0 |
| 0 | 1 | 1 |
| 1 | 0 | 1 |
| 1 | 1 | 1 |
There is a third two-input gate worth knowing by name: XOR, short for "exclusive OR". It is like OR but fussier — it is true when the inputs are different, and false when they are the same. So two trues make a false, which surprises people. XOR is the gate behind "one or the other, but not both" — a fair coin toss between two choices.
| A | B | Out |
|---|---|---|
| 0 | 0 | 0 |
| 0 | 1 | 1 |
| 1 | 0 | 1 |
| 1 | 1 | 0 |
XOR has a quiet superpower: add two single bits with it and you get the right answer for the last digit, every time (0 xor 0 = 0, 1 xor 0 = 1, 1 xor 1 = 0, carry the one). That's why XOR sits at the heart of the circuit that does addition — the part of a computer that actually adds up is built largely from XOR and AND gates.
One gate answers one small question. The magic happens when you wire the output of one gate into the input of the next — then a circuit can answer a question that no single gate could. Here is a real example. An alarm should sound when a window is open AND the system is armed — but not if you've pressed the "I'm home" button. You can build that from gates you already know:
That is genuinely how a computer "thinks". There is no cleverness hidden anywhere — only millions of these gates, wired together, each answering its one true-or-false question, passing the answer along. Out of that, and nothing more, comes everything: arithmetic, memory, decisions, the whole machine. A circuit doesn't understand. It just follows the rules of true and false, very fast, very many times.
Tap each card — the rule each gate follows:
Pick a gate, then flip its inputs between 0 and 1. The lamp shows the gate's answer, and the row underneath fills in the matching line of the truth table. (NOT has only one input, so its second switch quietly steps aside.)
Fresh one. Here is the AND gate with one output missing. AND is true only when both inputs are true.
A=0 B=0 → 0 ·
A=1 B=0 → 0 ·
A=0 B=1 → 0 ·
A=1 B=1 → ?
Fresh one. XOR is true only when the inputs are different. You feed it A = 1 and B = 0. What is the output?
Imagine explaining it to a friend who has never seen a logic gate. Use an everyday example if it helps — two switches, a door and a button, anything. Try to make clear when each gate gives true. Three or four sentences is plenty. Try to use, in your own way, the words AND, OR, true and both.
strong You caught the heart of it — AND needs both, OR needs only one. That single word "both" is the whole difference, and you leaned on it. The everyday example you reached for makes the rule feel obvious rather than abstract, which is exactly what a good explanation does.
try this One sentence describes OR as "either one", which is right, but it's worth adding the small extra: OR is also true when both are true. That "or both" is the part people forget, and naming it shows you've read the whole truth table, not just the easy rows.
to add You could close with one line on why this matters: that real circuits are built by wiring these simple rules together. That turns two definitions into the start of an idea about how a computer thinks.
Sit down with Dad for any of these. They show how true and false, wired together, became the machine on your desk. Heavier titles flagged for a chat first.
Two short films to watch alongside today's lesson — each shows you something the words and pictures can't.
You learned that a circuit reads 1 and 0 as true and false. You met the gates: NOT flips, AND needs both, OR needs either, and XOR wants them different. You read their truth tables, combined gates to make a real decision, and saw that a computer "thinks" only by answering millions of true-or-false questions, very fast. There is no magic in there — just logic. Florence, this is computing.
You can build every other gate out of just one kind, called NAND (an AND with a NOT on the end). Wire enough NANDs together in the right way and you can make NOT, AND, OR, XOR — and from those, a whole computer. Engineers call NAND "universal" for exactly this reason: one humble gate is, in principle, enough for everything.