Other tricks for squashing bugs
Besides the debugger, try these tricks while debugging:
Green glow
Tynker Workshop highlights each script green as you run it.
If your code doesn’t glow green, it’s not running. In other words, the condition or event that triggers the code isn’t working.
Print values
You can make your actors report the value of a variable or their own properties on stage using say or set label blocks.
For example, an actor reports the new value of score after it changes:
Or use the same trick with the actor properties block:
Comment your code
Are you making a big project but don’t have time to finish coding it in one sitting? Add comments to your code, reminding you of what needs to be done or isn’t working yet.
Tynker’s comments look like this:
More ideas
Here are a few more tricks for reducing errors and fixing bugs in your code:
Write code a little bit at a time—run your code as you add features, rather than writing everything all at once.
Save different versions of your code before making big changes, in case you need to revert. Use Save As to save a different version of your Tynker project.
Experiment in a new project, testing a small piece of your code—use Tynker’s Backpack [ICON] to save code so you don’t have to rewrite your script.
Ask a teacher or another coder for help.
Get a good night’s sleep and try again tomorrow! The best debugger is a well-rested mind.