Skip to content

Instantly share code, notes, and snippets.

@wen-yuxiang
Forked from nextacademy-private/deaf_aunty.rb
Last active August 29, 2015 14:26
Show Gist options
  • Select an option

  • Save wen-yuxiang/25587614d979742e8382 to your computer and use it in GitHub Desktop.

Select an option

Save wen-yuxiang/25587614d979742e8382 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
sentinel = 0
puts "Do you want to talk to your aunt? If yes please say something"
while (sentinel<2)
input = gets.chomp
if (input.downcase == "i love ya, aunty, but i've got to go.")
puts "Goodbye dear"
break
elsif input == ""
sentinel += 1
elsif (input == input.upcase)
puts "NO, WE CAN'T DO THAT!"
sentinel = 0
else
puts "HUH?! SPEAK UP, SANDRA!"
sentinel = 0
end
end
end
# Run our method
deaf_aunty
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment