Created
August 9, 2014 18:25
-
-
Save nedzadarek/8bf0c72ee50373ca1b06 to your computer and use it in GitHub Desktop.
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
def correct? input | |
if 24 == input | |
puts "great job! you did it!" | |
true | |
else | |
puts "please try again" | |
false | |
end | |
end | |
while true | |
begin | |
user_input = gets | |
int = Integer user_input | |
break if correct? int | |
rescue ArgumentError => e | |
puts "invalid characters entered" | |
puts "please try again" | |
puts | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment