GCSE · Computer Science · Eduqas · Spec C500QS
Break point
Your program runs, prints an answer, and the answer is wrong, with no error message. How do you look inside it? Freeze it halfway.
Computer Science · Software development
Freeze it twice and look inside
Two break points, one hidden logic error.
This program should print the average of three test scores. Break points are on line 5 and line 6. The ▶ marks the line the program has reached; at a break point it has not run that line yet. Nothing is run here: every value is the lesson's.
score1 = 12score2 = 18score3 = 15total = score1 + score2 + score3average = score1 + score2 + score3 / 3print(average)
Variables
(no variables yet)
Step 1. The run starts at line 1. The break points are on line 5 and line 6, so lines 1 to 4 run straight through without stopping.
WHAT YOU'VE LEARNED
A quick recap of today's lesson.
Freeze a running program on a line you choose, then look inside it.
What you need to know
- A break point is a tool in a development environment (IDE) that helps you test and debug a program.
- You set it as a marker on a line of code that you choose.
- Setting a break point doesn't change your code. It only changes how the program runs while you test it.
Have a goSam sets a break point on line 4 and announces: “I've added a new line to my program!” Is Sam right?
No. The program's code is exactly the same as before.
A break point is a marker, not code. It only affects how the program is run while it is being tested in the development environment.
- When the running program reaches that line, execution pauses (stops temporarily) before the line is carried out.
- While it's paused, you can examine the program's current state, such as the values held in variables.
- Then you continue, and the program runs on until it reaches the next break point or ends.
Have a goBreak points sit on lines 3 and 8. The program is paused at line 3 and you press continue. Where does it stop next?
At the break point on line 8.
Continuing resumes the run, and it goes on until the next break point, or until the program ends if there isn't one.
- You can set several break points in one program, to check its state at different stages.
- Check that state against what you expected, and you narrow down where a logic error is.
Have a goAt a pause, a variable you expected to hold 20 holds 14. Has the logic error already happened, or not yet?
Already. The value is wrong at this point.
A wrong value at the pause means something went wrong in the lines that ran before it, so that is where you look, not at the lines still to come.
The big picture
A break point is a marker you set on a line of code in a development environment. When the running program reaches that line it pauses before the line is carried out, so you can examine the values it holds, then continue. Compare what you see with what you expected and you can narrow down where a logic error is, without changing the code.
Key points
Worked example
Problem
A program should print the cost of 6 pens at £2 each, plus £3 postage, minus a £4 discount: £11. It prints 7 and shows no error message. Line 1: pens = 6. Line 2: price = 2. Line 3: cost = pens + price. Line 4: cost = cost + 3. Line 5: discount = 4. Line 6: cost = cost - discount. Line 7: print(cost). Use break points to find the faulty line.
⚠ Watch out
Thinking a break point stops the program for good, or fixes the code. It pauses the run before the marked line, you examine the state, and the code is untouched.
Memory hook
A break point is a pause button, not a stop button: freeze, look, carry on.
Check yourself
A program is paused at a break point on line 6. Has line 6 been carried out yet? What could you look at now, and what would you compare it with?
Flashcards
(11)What is a break point?
How do you set a break point?
What happens when the running program reaches a line with a break point?
Does the pause come before or after the marked line is carried out?
Does a break point end the program?
What can you examine while the program is paused?
What happens when you continue from a break point?
Why set several break points in one program?
Does setting a break point change the program's code?
How does a break point help find a logic error?
A variable is already wrong when the program pauses. Where do you look?
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 Eduqas GCSE Computer Science topics
How this lesson was checked. This Eduqas GCSE Computer Science (specification C500QS)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 16 November 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.