GCSE · Computer Science · AQA · Spec 8525
Equal to (relational operator)
The line score = 10 asks a question in one language and gives an order in another. Today you'll learn to tell which, and why it matters.
Computer Science · Programming
One question, asked three times
A guess-the-number game. The secret is 7, and the player types 3, then 9, then 7. Step through and watch the column headed guess = secret.
Every time line 4 lights up, say True or False out loud before you press Next.
1 secret ← 72 REPEAT3 guess ← USERINPUT4 UNTIL guess = secret5 OUTPUT 'Correct!'
| secret | guess | guess = secret | OUTPUT |
|---|---|---|---|
| 7 |
Output
Step 1: Line 1 is an assignment. Read the arrow as an order: store 7 in secret. A variable has changed, so 7 goes in its column.
Press Next one step at a time. Predict every guess = secret answer before it appears.
Same symbol, different job
Does this line ask, or does it store?
Put each line in the right column. Does it ask whether two values are equal, or does it store a value in a variable?
Still to sort
Asks: are these two values equal? (0)
Gives True or False. No variable changes.
Where the line is: If the line checks two values and nothing is being put into a variable, it's asking.
Stores a value in a variable (0)
An order. The variable on the left now holds a new value.
Where the line is: If a variable ends up holding something new, the line is storing, whatever symbol it uses.
Each line is labelled with its language. The symbol = turns up in both languages, but it does not do the same job in both.
AQA's exam pseudo-code writes assignment as ← and equal to as =. In your own programs, use the symbol your programming language uses for equal to.
WHAT YOU'VE LEARNED
A quick recap of today's lesson.
It compares two values, answers True or False, and changes neither of them. That answer decides what the program does next.
What you need to know
- Equal to compares two values. It gives True if they are the same and False if they are not.
- Checking a condition never changes a variable. Only assignment (← in pseudo-code) stores a value.
- The True or False answer decides what runs next, such as which part of an IF runs or whether a loop goes round again.
- Different languages use different symbols. Pseudo-code writes equal to as =. Python writes it as ==, because Python's = means assignment.
The big picture
Equal to is a relational operator. It compares two values and gives True if they are the same and False if they are not. It never changes either value, and its answer decides what the program does next. Pseudo-code writes equal to as = (and assignment as ←). Python writes it as ==, because Python's = means assignment.
Key points
Worked example
Problem
Dry-run this pseudo-code when the user types 12. What does it output? target ← 10 entry ← USERINPUT IF entry = target THEN OUTPUT 'Exactly right' ELSE OUTPUT 'Not quite' ENDIF OUTPUT entry
⚠ Watch out
Treating = in a condition as if it sets the variable. IF score = 10 THEN doesn't put 10 in score. It asks whether score already holds 10. The mirror-image slip is writing = where you meant to store a value, so the variable never changes.
Memory hook
Arrow stores, equals asks. And in Python: one = stores, two == ask.
Check yourself
Without looking back: in pseudo-code, what is the difference between total ← 0 and IF total = 0 THEN? Now say how you'd write each of those two lines in Python.
Flashcards
(7)What does the equal to operator do?
Does checking guess = secret change guess or secret?
In pseudo-code, which symbol means equal to, and which means assignment?
How does Python write equal to, and why isn't it just =?
What does the True or False answer of an equal-to condition do?
How should you read IF a = b THEN aloud?
A Python line reads if level = 3: — what's wrong?
Tap any card to flip it, or use Study as deck to go through them one at a time. In the full lesson these run as a spaced-repetition deck — you rate each card Hard, Good or Easy and the tricky ones keep coming back until they stick.
Learning with Lightbulb is opening soon
You can use this lesson now. Join the waitlist and we'll let you know when the full Lightbulb experience is ready.
Keep me postedMore AQA GCSE Computer Science topics
How this lesson was checked. This AQA GCSE Computer Science (specification 8525)lesson was published through Lightbulb Learning's human-designed editorial process — the educational standards, accuracy rules and publication checks it must pass were authored and approved by Philip Halpin. It passed subject-specific assessment, automated educational checks and technical publication verification before going live (publication checks completed 29 September 2026). Published pages are monitored, human spot-checking is ongoing across the lesson library, and anything found wrong is corrected or withdrawn. How our lessons are made and checked. Spotted a mistake? Email hello@lightbulblearning.co and we'll review it.