GCSE · Computer Science · AQA · Spec 8525
Less than (relational operator)
Two laps, both 49 seconds. Your program has to name the fastest lap. Does it pick the first one or the second? One symbol decides, and it's <.
Less than · inside an algorithm
Which lap was fastest?
A runner's five lap times are 52, 49, 53, 49 and 50 seconds. The program keeps the fastest time so far and the lap it happened on. Each new time is tested with time < fastest, and only a True result lets it in.
Laps 2 and 4 both took 49 seconds. Before you step through: will the program output lap 2 or lap 4?
1 fastest ← lap 1 time2 bestLap ← 13 FOR lap ← 2 TO 54 time ← next lap time5 IF time < fastest THEN6 fastest ← time7 bestLap ← lap8 ENDIF9 ENDFOR10 OUTPUT bestLap
| lap | time | time < fastest | fastest | bestLap |
|---|---|---|---|---|
| 1 | 52 | 1 |
Output
Step 1: Lap 1 takes 52 seconds. It's the only lap so far, so it's the fastest so far.
Before each Next, say whether the test will be True or False and what fastest will be. Then check.
Predict, then check
Loops are where < most often catches people out.
count starts at 1. The loop is WHILE count < 5, and each pass outputs count and then adds 1 to it. What is the last number this loop outputs?
AQA's pseudo-code writes less than as the symbol <.
WHAT YOU'VE LEARNED
A quick recap of today's lesson.
What you need to know
- < is the relational operator 'less than'. It compares two values, and the result is True or False.
- a < b is True only when a is strictly smaller than b. If the two are equal, or a is bigger, the result is False.
- The order of the two sides matters: reading < limit and limit < reading ask reverse questions.
- In a loop such as WHILE count < 5, the loop stops as soon as count reaches 5, so the loop body never runs with count equal to 5.
- Different programming languages may use different symbols for less than. The meaning stays the same.
The big picture
< is the relational operator 'less than'. It compares two values and gives True only when the left value is strictly smaller than the right, so 5 < 5 is False. Order matters: a < b and b < a ask reverse questions. You'll use < in IF statements and loops in your own programs, and you need to read it correctly in algorithms. Different languages may write it with different symbols, but it always means the same thing.
Key points
Worked example
Problem
A cinema gives a child ticket to anyone under 12. Write the IF condition, then decide which ticket each of these customers gets: age 11, age 12 and age 13.
⚠ Watch out
Treating < as if it included equal values, for example saying 12 < 12 is True. When the two values are equal, < always gives False.
Memory hook
The pointy end of < faces the value that has to be smaller. And a tie is never smaller: equal is not less.
Check yourself
Quick check, no looking back: is 6 < 6 True or False? And to test 'score is below 50', which side of < does score go on?
Flashcards
(9)What does the operator < mean?
What kind of result does a < comparison give?
Is 8 < 8 True or False?
Do x < y and y < x ask the same question?
A 'find the lowest' algorithm uses IF value < lowest. What happens when a value ties with lowest?
In WHILE count < 10, does the loop body ever run with count equal to 10?
Is −5 < −2 True or False?
Does every programming language have to write less than as <?
Which words in a requirement usually point to <?
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.