ga-wdi-boston/wdi_1_ruby_hw_number_guess — pull request #22 by juliesof (2014-06-10 03:31:21+00:00)
Title: Number guessing game

By going through each step and making it functional one at a time I was able to get the program up and running without too much trouble. The first challenge I had was figuring out what would be the best type of loop to use for the program. I tried an unless loop, the while loop, and various boolean expressions before deciding on the current while loop with a guess counter to iterate.

I also encountered some issues with the if/else statement not outputting the correct answer when it was guessed. After playing with it I realized I hadn't converted the guess variable into the int class. By using guess.to_i the if/else statement evaluated correctly.

Before I put "exit" into the if/else statement, a correct answer would create an infinite loop in the command line return.

Another bug I saw was that if the user guessed correctly on the third try then it wouldn't output the "you're right" answer, but rather the final statement. So I took the final instance of the guessing out of the main while loop and ran the statement on their own, and this fixed the bug.