GCSE · Computer Science · AQA · Spec 8525

Less than or equal to (relational operator)

'Maximum 8 people,' says the lift sign. Eight step in. Allowed? Of course: 8 is the limit, not over it. Programs say 'up to and including' with one symbol: ≤.

Computer Science · Programming

Follow the loop right up to its limit

Press Next to move one step at a time. Keep your eye on the diamond when count reaches 3.

Predict first: when count reaches 3, does the path go round the loop again?

YesNoStartcount ← 1count ≤ 3?OUTPUT countcount ← count + 1End

Output

 

Step 1: Start. This program counts upwards, and the diamond sets the limit: 3.

1 / 13

Next moves one step, Back moves one step back, and Play runs the whole thing.

Step 1 of 13: Start. This program counts upwards, and the diamond sets the limit: 3..

Watch out: If the diamond said count < 3 instead, the check 3 < 3 would be False and the output would stop at 2. The little line under ≤ is what lets 3 through.

Two tests hiding in one symbol

The limit is 5. Each test below gives True or False. For each value of x, tick every test that is True.

x = 2
x = 4
x = 5
x = 8

Predict, then check

Same idea, written for two different readers.

Here is one loop condition written twice. Pseudocode: WHILE count ≤ 3. Python: while count <= 3 — do these two lines test the same thing?

UK note

AQA pseudo-code writes this operator as the single symbol ≤.

Computer Science · Algorithms

Trace table — dry run the code

A new loop, traced the way you'd do it on paper. The n ≤ 8 column records every check. Predict the output before you reach the last row.

1total ← 0
2n ← 2
3WHILE n ≤ 8
4 total ← total + n
5 n ← n + 2
6ENDWHILE
7OUTPUT total
n
total
n ≤ 8
Output
Press Start to run the first line.
·

Ready when you are — step through one line at a time.

Your turn: write the condition

A quiz gives each player at most 3 attempts. The variable attempts starts at 1 and goes up by 1 after each go. (a) Write the WHILE condition that keeps the quiz going while the player is still allowed an attempt. [2] (b) State how many attempts the player gets. [1] [3 marks]

0 words · your answer stays on this page and is not sent anywhere.

WHAT YOU'VE LEARNED

A quick recap of today's lesson.

The comparison that lets the equal value through.

What you need to know

  • ≤ means 'less than or equal to'. It compares two values, and the answer is always True or False.
  • x ≤ 5 is True when x is smaller than 5 AND when x is exactly 5. It is only False when x is bigger than 5.
  • In a loop controlled by WHILE count ≤ 3, the loop body still runs when count equals 3, because the limit is included.
  • Languages write the same test in different ways. Pseudocode can use ≤; many programming languages, such as Python, type it as <=.

The big picture

≤ compares two values and gives True when the left value is smaller than the right one OR equal to it. In an IF or WHILE condition that means the limit itself is included, so a loop controlled by count ≤ 3 still runs when count is 3. Different languages write the same test differently; many type it as <=.

Key points

1≤ is 'less than' OR 'equal to': two tests joined into one.
2The equal value gets through: 5 ≤ 5 is True, but 5 < 5 is False.
3Read the condition left to right: x ≤ 10 asks 'is x no more than 10?'
4'At most', 'no more than' and 'up to and including' in a task all point to ≤.
5Swap ≤ for < and a loop whose count lands exactly on the limit stops one pass sooner.

Worked example

Problem

A cinema lets children aged 12 or under in for half price. Write an IF statement that outputs "Half price" for these children, using a variable called age.

⚠ Watch out

Treating ≤ as if it were <. When tracing WHILE count ≤ 3, it's easy to stop as soon as count reaches 3, but 3 ≤ 3 is True, so the loop body runs once more and 3 is output.

🧠

Memory hook

≤ is just < with a line underneath, and that line is the 'or equal' part. No line means no equals, and the limit gets turned away.

✓

Check yourself

No peeking: n ← 2, then WHILE n ≤ 6 the loop outputs n and adds 2. What gets output? (Answer: 2, 4, 6. 6 ≤ 6 is True, so 6 is output.)

Flashcards

(8)
What does the operator ≤ mean?
Less than or equal to.
What kind of answer does a comparison like x ≤ 5 give?
True or False.
7 ≤ 7 and 7 < 7: which one is True?
7 ≤ 7 is True and 7 < 7 is False. Only ≤ lets the equal value through.
When is x ≤ 10 False?
Only when x is bigger than 10.
How do many languages, such as Python, type ≤?
As <=, with the < first and the = second.
Which words in a task point to ≤?
'At most', 'no more than' and 'up to and including'.
In a loop with WHILE count ≤ limit, does the body run when count equals the limit?
Yes. The condition is still True, so it runs once more.
Is x ≤ 5 the same test as 5 ≤ x?
No. The order matters: 5 ≤ x asks whether 5 is no more than x.

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 posted

More AQA GCSE Computer Science topics

See the full AQA Computer Science curriculum →

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.