GCSE · Computer Science · AQA · Spec 8525
Greater than (relational operator)
A rocket countdown goes 3, 2, 1... Lift off! So why does the program never say 0? One small symbol makes that decision, and it's pickier than it looks.
Greater than · Watch it decide
Why does the countdown never say 0?
Every time round, the loop asks one question: is count greater than 0? Step through and watch the answer in the count > 0 column.
Predict first: will the last number output be 1 or 0?
1 count ← 32 WHILE count > 03 OUTPUT count4 count ← count - 15 ENDWHILE6 OUTPUT 'Lift off!'
| count | count > 0 | OUTPUT |
|---|---|---|
| 3 |
Output
Step 1: count starts at 3. Nothing has been checked yet.
Use Next to step through one line at a time. Keep your eye on the count > 0 column.
Predict, then check
So far you've seen > in pseudo-code. The programs you actually run are written in a programming language, like Python.
Here's one check written two ways. In pseudo-code it's IF temp > 30 THEN, and in Python it's if temp > 30: with a colon on the end. What happens to the greater than part?
WHAT YOU'VE LEARNED
A quick recap of today's lesson.
A question your program asks: is the left value bigger than the right? The answer, True or False, decides what happens next.
What you need to know
- > is the greater than operator. It compares two values and asks: is the left value bigger than the right value?
- It's a relational operator: an operator that compares two values. The result is a Boolean value, True or False.
- > is strict. It's True only when the left value is bigger. If the two values are equal, the result is False: 5 > 5 is False.
- The order matters. a > b and b > a are different questions: 9 > 4 is True, but 4 > 9 is False.
- Programs use > in conditions. In a WHILE loop, True means go round again and False means stop. In an IF, True means run that branch.
- Each programming language has its own rules for how its operators are written. In pseudo-code and in Python, greater than is written >.
The big picture
The greater than operator, written >, compares two values and asks: is the left value bigger than the right value? The answer is True or False. It's strict: if the two values are equal, the answer is False, and swapping the sides asks a different question. Programs use > in conditions, so the answer decides whether a loop goes round again or an IF runs its branch. Each programming language has its own rules for how its operators are written; in pseudo-code and in Python, greater than is written >.
Key points
Worked example
Problem
An algorithm works through a list of four scores, nums = [4, 9, 6, 11], where nums[0] is the first score. It starts with biggest ← nums[0]. Then, for i from 1 to 3, it runs IF nums[i] > biggest THEN biggest ← nums[i]. At the end it outputs biggest. What does it output, and what job is the > doing?
⚠ Watch out
Writing the comparison the wrong way round. To ask 'is score over 50?' you need score > 50. Writing 50 > score asks the opposite question: is 50 the bigger one? Say the condition out loud as a question before you write it.
Memory hook
The wide, open end of > faces the value that has to be bigger. And it has to be BIGGER: 'as big as' doesn't count.
Check yourself
In the countdown, suppose count started at 0 instead of 3. What would the program output, and why?
Flashcards
(7)What question does a > b ask?
What kind of result does a > comparison give?
What does 5 > 5 give?
9 > 4 is True. What is 4 > 9?
What is a relational operator?
A loop starts WHILE x > 10. When does it stop going round?
What decides how the greater than operator is written in a programming language?
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 30 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.