Bugs and debugging

Knowledge Videos

Short animated explainers, organised by subject.

Bugs and debugging

A bug is a mistake in a program. Debugging is finding it and fixing it: predict, run, compare, fix, shown on a square that does not close.

Transcript

A bug is a mistake in a program. This program should draw a square, but the shape does not close.

Debugging means finding and fixing bugs. Use four steps: predict, run, compare, and fix.

First, predict what should happen: a closed square. Run the program and watch. Compare the result with your prediction. They are different, so there is a bug. Look closely: the turn is eighty degrees, not ninety.

Fix the block, and run it again. Now the square closes. Every programmer makes bugs, and finding them is a skill you can practise.

Remember: a bug is a mistake in a program, and debugging is finding and fixing it. Predict, run, compare, fix.

More in this series