Skip to content

Instantly share code, notes, and snippets.

@SeokSeth
Forked from nextacademy-private/deaf_aunty.rb
Last active January 12, 2016 09:45
Show Gist options
  • Select an option

  • Save SeokSeth/a941b6be4aec7864b88a to your computer and use it in GitHub Desktop.

Select an option

Save SeokSeth/a941b6be4aec7864b88a 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
polite = false
counter = 0
def deaf_aunty(string)
if string == "i love ya, aunty, but I've got to go"
polite = true
elsif string == string.upcase
puts "NO, WE CAN'T DO THAT!"
elsif string != string.upcase
puts "HUH?! SPEAK UP, SANDRA!"
end
return polite
end
until polite || counter == 2 do
print "You :"
myself = gets.chomp
if myself.empty?
counter += 1
else
polite = deaf_aunty(myself)
counter = 0
end
end
deaf_aunty
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment