Created
August 30, 2011 23:59
-
-
Save danlynn/1182447 to your computer and use it in GitHub Desktop.
Sublime fails to obtain system input
This file contains 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/env ruby | |
@my_number = (rand(10) + 1).to_s | |
@tries = 10 | |
def try | |
print "Tries left = #{@tries -= 1}: Guess my number (1..10): " | |
gets.chomp == @my_number rescue puts "<nil input>" | |
end | |
while (!(succeed=try()) && @tries > 0); end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment