Skip to content
Home: Success TutoringTeachers

Computer Science glossary Β· Kindergarten to Grade 8

Bug

Also called: error, glitch

What it means

A bug is a mistake in an algorithm or program that makes it do something you did not expect, or stop working.

Examples

  • A program meant to draw a square draws only 3 sides because it repeats 3 times instead of 4.
  • A score goes down instead of up because the code says change score by -1.
  • Instructions say "turn left" where the path needs "turn right".

For teachers

Bugs include syntax errors (the code is not written in a form the computer accepts), logic errors (the code runs but does the wrong thing, such as a step in the wrong order or a wrong condition) and errors that only appear with certain inputs. Logic errors are the hardest to spot because nothing crashes. Ask students to describe a bug precisely ("when I press the up arrow, the sprite moves down") before trying to fix it.

Common misconception

Some students think a bug always makes a program crash or show an error message. Many bugs let the program keep running but give the wrong result, so you need to test and check the output carefully.

Lesson plans that teach it

Browse the full glossary