Skip to content

Instantly share code, notes, and snippets.

@AknEp
Created October 20, 2012 12:01
Show Gist options
  • Save AknEp/3923119 to your computer and use it in GitHub Desktop.
Save AknEp/3923119 to your computer and use it in GitHub Desktop.
Check the input is "y" or "n", or not.
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