Skip to content

Troubleshoot Common Programming Errors

Playback Speed:

When you program, you use a language to talk to a computer.

However, sometimes you make a mistake in the programming language, and the computer doesn’t understand.

When that happens, you get an error message.

Even the most experienced programmer often makes mistakes.

Knowing how to troubleshoot mistakes in your code is an important skill.

In this extension, you will familiarize yourself with two common coding errors, read and interpret error messages, and solve the problems in your code.

There are many different types of programming errors.

In this extension, you will learn about syntax errors.

Syntax is the order of words in a language.

When we speak English, for example, we follow specific rules of syntax.

It is difficult to understand a sentence when the words aren’t in the expected order, but we use reasoning and our own experiences to reorder and interpret the message.

In programming, syntax errors happen when you create code that doesn't follow the rules of the programming language.

Code that doesn’t follow the rules won’t make sense to the computer.

Unlike humans, computers lack the reasoning ability to understand a sentence with grammar or spelling errors.

To begin troubleshooting error messages, open your progress bar presentation.

Look at the code you used to build your progress bar.

It begins with an open curly brace and ends with a closed curly brace.

These braces tell the computer when to start a function and when to end it.

Delete the final closing curly brace.

You just created a syntax error.

Next, save your function and read the error message.

It says there is a missing closing curly brace.

It also lets you know which line has the mistake, and highlights the line.

Now, replace the closing curly brace, and save your code again.


No errors.

Another common syntax error is a misspelling.

For instance, what if you typed the words Solid Fill to color in the shapes in your progress bar, but forgot the second L in Fill?

Create that mistake.

Then save and run your function.

Read the error message.

It’s a type error.

Find which line of code contains the error, and correct it.

Save and run the function.

No errors.

Nice work!

Not all programming problems are clear and simple to fix.

If you are unable to troubleshoot an error by yourself, ask a neighbor for help, or search the internet for the error message.

Lots of people have probably encountered the same issue, and you can often find the solution online.

The programming community shares common errors and solutions, so others can learn from them.

This is a great part of learning how to program, and to challenge yourself further, ask a neighbor or your teacher to create an error in your code while you aren’t looking.

See if you can figure out how to fix the problem they created.

Now, it’s your turn: open your presentation from Google Drive; delete the final closing curly brace, and save your function; read the error message, and fix the problem; misspell the word fill, and save and run your function; and read the error message, and fix the problem.

Choose an Extension
Share Your Code
Share your code so that your partner can from your programming to create their own progress bar.
Duplicate Multiple Slides and Extend Your Progress Bar
Insert additional slides in your presentation then run the script editor again so the progress bar appears throughout the entire expanded presentation
Troubleshoot Common Programming Errors
Read and interpret error messages, and solve the problems in your code.
Copy Your Code to Try a New Fill Color
Make a copy of the code and then change the color in your progress bar.
Add a Progress Bar in Google Forms
Make your surveys, quizzes, and forms more user-friendly by showing a progress bar.
Assign a Custom Color with Hex Codes
Change a font color in your presentation using a hex color code.
See more extensions
Next Lessons Dashboard
Choose one or more extensions to add more features to your code and learn more ways to use progress bars.
Shared work attachment
URL not accepted. Please paste a link to a Scratch project. URL not accepted. Please paste a link from (such as a Google Doc). You don't appear to be signed in. Please refresh the page and try again. Something went wrong. Please refresh the page and try again.

This project will be shared with your teachers

Students can submit their work on this page. View their submitted work on the student progress page of My Classes.

Students can submit their work on this page.

Students: sign in to submit your work.
Teachers: sign in to view submitted work.