11 Debugging
No matter how experienced you get at writing code, there will be times when the code you write doesn't work the way you expect. Isolating and fixing the errors is called debugging and is a fascinating mental challenge, or a complete headache depending on how you are feeling that day! In this chapter we will look at many of the more common errors and look at techniques for isolating the problem and then fixing it.
Strings and Numbers
You have created a game that allows the user to input a numeric value using an input box. Then you run this code:
on (release){
num = num + userInput;
}
You have a num of 14, and a userInput of 10. You expect the num to be set to 24; instead it is set to 1410. Why? Simple really, userInput ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access