From the course: Visual Studio Code for Python Developers

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Stepping through code

Stepping through code

From the course: Visual Studio Code for Python Developers

Start my 1-month free trial

Stepping through code

- All right, once we've created a debugging configuration we are ready to use the debugger to step through our code and examine variables and expressions. So here we are in my chapter three, this is lesson two folder and I've got a copy of the code here so I'll open that and we'll switch to the debugger view. And as we did in the previous example, I will start the program debugging by clicking on this little arrow. And because our launch.json file has the stopOnEntry property set to True, the execution of the program stops right when I begin debugging. And you can see it's paused here on the very first statement which, in this case, is where my code imports the math module. You can also see the debug tool bar that appears up here at the top and the status bar down here turns orange to indicate that we are in debug mode. So before I do anything else, I can just start stepping through the code line by line as the Python interpreter executes the program. So to step one line, I can click…

Contents