Skip to content

Instantly share code, notes, and snippets.

@KevinSia
Last active September 12, 2017 17:52
Show Gist options
  • Save KevinSia/8e2b8e5cf2d9d283bde3bc4b4ded7c21 to your computer and use it in GitHub Desktop.
Save KevinSia/8e2b8e5cf2d9d283bde3bc4b4ded7c21 to your computer and use it in GitHub Desktop.
def deaf_aunty
conversation_done = false
until conversation_done
puts 'Say something to aunty'
reply = gets.chomp
if reply == reply.upcase
puts 'NO, WE CAN\'T DO THAT!'
elsif reply == 'I love ya, aunty, but I\'ve got to go'
if gets.chomp == '' && gets.chomp == ''
puts 'Aunty allows you to leave'
conversation_done = true
else
puts "WHERE ARE YOU GOING?"
end
else
puts 'HUH?! SPEAK UP, SANDRA!'
end
end
end
end
# Run our method
# Remember to comment this before submitting your challenge
deaf_aunty
def deaf_aunty
# `loop do` creates an infinite loop that can be broken with the word `break` (line 19)
loop do
reply = ''
until reply == 'I love ya, aunty, but I\'ve got to go'
puts 'Say something to aunty'
reply = gets.chomp
if reply == reply.upcase
puts 'NO, WE CAN\'T DO THAT!'
else
puts 'HUH?! SPEAK UP, SANDRA!'
end
end
if gets.chomp == '' && gets.chomp == ''
puts 'Aunty allows you to leave'
break
else
puts "WHERE ARE YOU GOING?"
end
end
end
# Run our method
# Remember to comment this before submitting your challenge
deaf_aunty
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment