Debugging in VSCode

Debugging in VSCode#

Debugging is an essential skill which will both increase your productivity and, more importantly, understand what your program does and therefore help you understand how python works.

The best way to learn what a debugger does is to watch it in action. We encourage you to spend 10 minutes watching the following video – it may easily be the 10 minutes of effort that gives you your biggest productivity boost as a programmer!

The debugger explained#

The debugger allows you to stop a program at any line while it is running. This allows you to:

  • Inspect what state the variables are in, and whether they match your expectations

  • Run new lines of code you write while the program is stopped.

The first features is a very useful tool for identifying bugs, because it allows you to quickly narrow down what part of the program is broken, and which works as you expect.

The second feature can be very useful when you are writing new code – indeed some developers find themselves writing much of their code within the debugger.