Skip to content

Instantly share code, notes, and snippets.

@eam
Created June 9, 2020 17:20
Show Gist options
  • Save eam/5c690aa696001337fa8f051b8f70058d to your computer and use it in GitHub Desktop.
Save eam/5c690aa696001337fa8f051b8f70058d to your computer and use it in GitHub Desktop.
#!/usr/bin/ruby
secret = rand(100)
100.times {
puts "guess the secret number"
guess = gets.to_i
if secret == guess
system "say you did it! horray!"
break
else
if secret < guess
puts "Go Lower!"
system "say Go Lower"
end
if secret > guess
puts "Get Higher!"
system "say Get Higher"
end
end
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment