For Students: Tips on Debugging Code

Tips for student on how to get un-stuck while programming on CodeHS

Claire Sindlinger avatar
Written by Claire Sindlinger
Updated over a week ago

Tools In the Code Editor

As a student, there are many debugging tools available in your Code Editor.

1. Docs Tab

Use the Docs in the Code Editor to see examples of all of the most important coding concepts that you've learned in the course so far. It's a great place to look for examples and check code syntax!

2. History Tab

The History tab can be found under More in the Code Editor. Here you can view every previous version of your program. If a program was working but now isn't, reviewing an earlier version is a great way to spot changes that might have caused an error.

Image showing history tab

3. Speed Slider and Step Debugger

Adjust the Speed Slider to run code more slowly so you can pinpoint where the program gets off-track. You can also use the Next and Last buttons at the top of the Code Editor to run code one line at a time. This allows you to zero in on the exact line of code causing the error.

Image showing speed slider, next, pause, and last button in code editor

4. Comment Out Code

Comment out different sections of code, then re-run the code. When the code runs, the commented-out portions will be skipped, allowing you to use process of elimination to target the portion of code that is causing an error.

5. Check the Error Messages and Test Cases

As much as possible, we always try to make error messages as informative as we can. If you're seeing an error message, check if it references a specific function, syntax error, or line of code that can be fixed before re-running the code.

Click here to learn more about the most common error messages you may run into when working on Karel assignments.

As a student, you can also click the red Test Code button to see where your program passes or does not pass the CodeHS Autograder. The progress bar at the top tells you how many tests you have passed.

Image showing Test Cases tab and check code button.

Other Helpful Debugging Resources

Review the Video and Slides

Don't forget! You can always rewatch the lesson video, and go back over the lesson slides to review all of the example code. This is a great way to refresh your memory if you forget a specific programming concept or proper syntax.

Review the Examples

Every CodeHS lesson includes an example, which shows the lesson concept in a live code editor. Review the example code at any time and compare your own work.

Still have questions on debugging? Ask your teacher for help!

Did this answer your question?