Skip to Content

XP 2: How do we fix broken code?

It’s OK to make mistakes when you code. We all do!

When you encounter an error or undesired result, we call this a “bug.”

What matters is figuring out what to do when things don’t work.

The process of fixing the error is called “debugging.”

Think About

  • How can I figure out how to fix something that isn’t working?
  • What resources or process do I use to solve a problem?

Get Started

Start debugging with either Scratch or Sonic Pi.

For Scratch – Do this:

  1. Try out any of the debugging challenges in this studio
    1. The smaller the number, the easier the debugging exercise.
    2. We suggest starting with Debug-It 1.1
  2. Read the directions on the right side of the screen.
  3. Click “see inside” (blue button near the directions).
  4. Try and figure out how to fix the problem. 

For Sonic Pi – Do this:

Check out this video on debugging with Sonic Pi

  1. Try one of these debugging challenges 
  2. Read the directions listed as comments (#) and copy and paste the code into Sonic Pi.
  3. See if you can challenge yourself to figure out what’s wrong with it before even running the code to see how it sounds.
  4. Note: If you get stuck, read the tutorials in Sonic Pi with the same header as the debugging exercise you are stuck on.

 Share What you Learned

If you are using the LRNG platform:

  • Go back, find out what to submit, and complete the XP