Debugging: Finding errors

Logic errors can be hard to find. Before you run a program, think about exactly what the output should be. When you run it look at the output carefully to see if it is what you expected.

You can also trace through the program by hand. Play "computer": think through what the computer will do for each line in the program.