Created
June 9, 2020 17:20
-
-
Save eam/5c690aa696001337fa8f051b8f70058d 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
#!/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