Skip to content

Instantly share code, notes, and snippets.

@ursm
Forked from yucao24hours/pretty_old_woman.rb
Last active December 20, 2015 11:29
Show Gist options
  • Save ursm/6123600 to your computer and use it in GitHub Desktop.
Save ursm/6123600 to your computer and use it in GitHub Desktop.
history = []
puts 'Hello! May I help you?'
while words = gets.chomp
history << words
break if history.last(3) == %w(BYE BYE BYE)
case words
when 'BYE'
# do nothing
when words.upcase
puts "Well, it hasn't happened since #{rand(1930..1950)}!"
else
puts 'Huh? Could you speak up, please??'
end
end
puts 'Thanks. Come back anytime.'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment