Created
October 20, 2012 12:01
-
-
Save AknEp/3923119 to your computer and use it in GitHub Desktop.
Check the input is "y" or "n", or not.
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
loop do | |
answer = gets.chomp | |
if answer == "y" | |
puts "You choose yes. See you." | |
break; | |
elsif answer == "n" | |
puts "You choose no. See you." | |
break; | |
else | |
puts "You typed #{answer} , you must type y or n." | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment