Skip to content

Instantly share code, notes, and snippets.

@aforlorncat1
Forked from nextacademy-private/deaf_aunty.rb
Last active November 30, 2015 04:07
Show Gist options
  • Select an option

  • Save aforlorncat1/8edcb4ab7c62fe3db498 to your computer and use it in GitHub Desktop.

Select an option

Save aforlorncat1/8edcb4ab7c62fe3db498 to your computer and use it in GitHub Desktop.
# Save this file to your computer so you can run it
# via the command line (Terminal) like so:
# $ ruby deaf_aunty.rb
#
# Your method should wait for user input, which corresponds
# to you saying something to your Aunty.
# You'll probably want to write other methods, but this
# encapsulates the core Aunty logic
def deaf_aunty(response)
if response == "I love ya, aunty, but I've got to go."
return "Bye-bye!"
elsif response == response.upcase
return "NO, WE CAN'T DO THAT!"
else
return "HUH, SPEAK UP, SANDRA!"
end
end
exit = false
blank = 0
while true
input = gets.chomp
if input != ""
response = deaf_aunty(input)
if response == "Bye-bye!"
puts "#{response}"
break
else
puts "#{response}"
exit = false
blank = 0
end
else
blank += 1
if blank == 2
break
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment