- Read Tutorial
- Watch Guide Video
- Complete the Exercise
Summary
Build the High/Low guessing game in Ruby where a user attempts to guess a number and the program lets them know if they need to guess higher or lower.
Exercise Description
This needs to be a terminal game that initially prompts the user to guess a number, you will also need to generate a random number so the answer will be different for each game. The start of the game should look like:
Guess a number between 0 and 24
If the user guesses a number lower than the answer, the output should be:
Higher - guess again
If the user guesses a number higher than the answer, the output should be:
Lower - guess again
When the user guesses the correct answer, the output should be:
Yay, you got it right!
And the game should end.
Real World Usage
This is a common interview question that tests your ability to work with: standard input from a user, looping, conditionals, and random numbers.