Skip to content

Instantly share code, notes, and snippets.

@g4vroche
Created November 6, 2013 22:38
Show Gist options
  • Save g4vroche/7345497 to your computer and use it in GitHub Desktop.
Save g4vroche/7345497 to your computer and use it in GitHub Desktop.
My Day #1 bonus problem implementation from seven languages in seven weeks
#!/usr/bin/ruby
max = 10
puts "hello world, try guessing a number beteen 0 and #{max}"
number = rand(max)
puts "Your guess(#{number}): "
guess = max + 1
while guess != number
guess = gets.to_i
if guess == number
puts 'Congrats !'
else
if guess > number
puts 'Too high !'
else
puts 'Too low !'
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment