Skip to content

Instantly share code, notes, and snippets.

@kylekeesling
Created November 10, 2015 19:55
Show Gist options
  • Save kylekeesling/1a255ebe6505823c5a83 to your computer and use it in GitHub Desktop.
Save kylekeesling/1a255ebe6505823c5a83 to your computer and use it in GitHub Desktop.
Deaf Grandma
chatting = true
byes = 0
while chatting
puts "Ask Grandma a question:"
said = gets.chomp!
if said == "BYE"
byes += 1
if byes > 2
chatting = false
else
puts "** Grandma is ignoring you **"
end
elsif said == said.upcase
year = 1930 + Random.rand(20)
puts "NO, NOT SINCE #{year}!"
else
puts "HUH?! SPEAK UP, SONNY!"
end
end
puts "Thanks for chatting with Grandma"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment