Skip to content

Instantly share code, notes, and snippets.

@danlynn
Created August 30, 2011 23:59
Show Gist options
  • Save danlynn/1182447 to your computer and use it in GitHub Desktop.
Save danlynn/1182447 to your computer and use it in GitHub Desktop.
Sublime fails to obtain system input
#!/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