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 tiny symbol makes that call, and it's fussier 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.
Press Next to step one line at a time. Keep your eye on the count > 0 column.
Predict, then check
So far you've met > in pseudo-code. The programs you actually run are written in a programming language, such as Python.
Here's a check in pseudo-code: IF temp > 30 THEN. You're about to write the same check in Python. Commit first: 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 one bigger than the right one?
- That makes it a relational operator: an operator that compares two values.
- The result is a Boolean value, True or False. You never get one of the numbers back.
Have a goYour mate swears 8 > 3 gives 8, "because 8 wins". What does 8 > 3 actually give?
True.
> answers a yes/no question, so the result is a Boolean, True or False. It never hands back the winning number.
- > is strict. It's True only when the left value is bigger, so 9 > 4 is True.
- Equal is not greater. If the two values are the same, the result is False: 5 > 5 is False.
Have a goThe shop door in a game opens when coins > 50. You've saved up exactly 50 coins. Does the door open?
No. 50 > 50 is False.
50 isn't bigger than 50, it's equal, and equal doesn't count as greater. You need at least one more coin.
- 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. False means skip it.
Have a goscore ← 40, then IF score > 50 THEN OUTPUT 'Pass' ENDIF. What gets output?
Nothing.
40 > 50 is False, so the IF's branch is skipped. 'Pass' only appears when the condition is True.
- Each programming language has its own rules for how its operators are written.
- In pseudo-code and in Python, greater than is written >. Read any operator by what it means.
The big picture
The greater than operator, written >, compares two values and asks one question: 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 that 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
- Constant declaration
- Convert character code to character
- Convert character to character code
- Correcting errors
- Data validation routines
- Equal to (relational operator)
- Greater than or equal to (relational operator)
- Identifying and categorising errors
- Indefinite (condition-controlled) iteration
- Integer / real to string conversion
- Integer data type
- Integer division and remainder
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 28 October 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.