Programming guide

Use a debugger instead of print statements

Learn to pause your code with breakpoints, step through it line by line and inspect variables so you can find the real cause of a bug faster than guessing.

Estimated time: 45–90 minutesUpdated: 1 October 2026

Use this guide when you have a bug where the code runs but gives the wrong result, or when you keep adding print lines and still cannot see what is happening. You need a code editor with a debugger, such as VS Code with the Python extension, or a browser's developer tools for JavaScript.

Step by step

  1. Reproduce the bug on demand

    Before opening the debugger, write down the exact input and steps that produce the wrong result, and what result you expected instead. Make the smallest version you can, such as a single function call with one set of values. A bug you can trigger reliably in a few seconds is a bug you can debug; a vague one is not.

Members

The rest of this guide is for members

The rest of this guide – the remaining steps, a ready-to-use checklist, practical tips and fixes for common problems – is for members. Membership unlocks every ABCDayZ guide.

£3.99 for 1 month or £29 for 12 months. One payment, no automatic renewal.

Unlock all guides

Already a member on another device? Open your personal access link. Bought Programming with AI? Your first month is included.