Debugging

Debugging is the process of finding and fixing errors (bugs) in code. It involves locating the cause of a problem and correcting it.

General Programming

Common debugging techniques include printing values to see what the program is doing, stepping through code with a debugger, and reading error messages carefully.

The name comes from a real moth found stuck in an early computer in 1947.

Examples

Python

total = 0
for n in [1, 2, 3]:
    total + n  # bug: result is thrown away
print(total)  # add a print to debug

Output:

0

Learn it in a lesson

See also

Back to the Dictionary