Why Debugging Exercises?
You may be wondering what the value is in solving debugging exercises. What are they and how do they help you learn?
One obvious benefit of solving this type of exercise is gaining experience picking apart code that someone else has written. Many student programmers spend a large amount of time with their own code, but very little time reading and working with existing code written by others. Being able to read and understand others’ code is an invaluable skill when you get your first programming job and must work on a team, or when you want to make your first open-source software contribution.
Let’s examine some very brief code samples.
Do you know how the output of the following two code snippets will differ? Can you explain why?
There is a bug in the below code preventing the factors of 18 from being displayed accurately. Can you spot it?
true in Ruby, but