Skip to content

Instantly share code, notes, and snippets.

@jacksy40
Last active August 29, 2015 14:10
Show Gist options
  • Select an option

  • Save jacksy40/1a2e858801c3949b4c95 to your computer and use it in GitHub Desktop.

Select an option

Save jacksy40/1a2e858801c3949b4c95 to your computer and use it in GitHub Desktop.
Deaf Grandma
#grandma excercise
puts ' Hi grandchild how are you? '
while true
response = gets.chomp
if response == 'BYE'
break
end
if response == response.upcase
puts 'NO, NOT SINCE..' + (rand(1950-1930)+1930).to_s
puts
else
puts 'HUH? SPEAK UP, SONNY!'
end
end
puts ' I\'LL TALK TO YOU LATER SONNY!'
# extended grandma
bye = 0
puts ' Hi grandchild how are you? '
while bye < 3
response = gets.chomp
if response == 'BYE'
bye = bye + 1
else
bye = 0
end
if response == response.upcase
puts 'NO, NOT SINCE..' + (rand(1950-1930)+1930).to_s
puts
else
puts 'HUH? SPEAK UP, SONNY!'
end
end
puts ' I\'LL TALK TO YOU LATER SONNY!'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment