Last active
September 12, 2017 17:52
-
-
Save KevinSia/8e2b8e5cf2d9d283bde3bc4b4ded7c21 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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