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.”
- How can I figure out how to fix something that isn’t working?
- What resources or process do I use to solve a problem?
Start debugging with either Scratch or Sonic Pi.
For Scratch – Do this:
- Try out any of the debugging challenges in this studio.
- The smaller the number, the easier the debugging exercise.
- We suggest starting with Debug-It 1.1
- Read the directions on the right side of the screen.
- Click “see inside” (blue button near the directions).
- Try and figure out how to fix the problem.
For Sonic Pi – Do this:
Check out this video on debugging with Sonic Pi
- Try one of these debugging challenges
- Read the directions listed as comments (#) and copy and paste the code into Sonic Pi.
- See if you can challenge yourself to figure out what’s wrong with it before even running the code to see how it sounds.
- 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