A debugger pauses a running program so you can inspect variable values one step at a time. It reports what the program is doing; you still decide which line is wrong. section 36.3
A simple debugging routine is:
- Choose the failing test and place a breakpoint where its execution begins. section 36.3
- Start debugging, then step through the code while watching the variable values. section 36.3
- Explain each line in plain English and remain skeptical, even when the line looks simple. section 36.3
Tracing a failed test
For a failing test of absolute_value(0), set a breakpoint before the function call and step through its conditionals. The debugger reveals the current line and values, helping you notice that the function handles n < 0 and n > 0 but needs attention when n equals zero. section 36.3
Use the debugging-window screenshot to connect the editor, console, variable explorer, breakpoint, and current execution line. section 36.3





