Skip to content

Instantly share code, notes, and snippets.

@wyattdanger
Created December 28, 2010 18:06
Show Gist options
  • Save wyattdanger/757493 to your computer and use it in GitHub Desktop.
Save wyattdanger/757493 to your computer and use it in GitHub Desktop.
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