Created
December 28, 2010 18:06
-
-
Save wyattdanger/757493 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
number = rand(10) + 1 | |
correct = false | |
puts "Guess a number between 1 and 10." | |
until correct do | |
guess = gets.to_i | |
correct = guess.equal? number | |
if correct | |
puts "You win!" | |
else | |
puts "Guess lower!" if guess > number | |
puts "Guess higher!" if guess < number | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment