/deaf_aunty.rb Secret
Last active
November 30, 2015 04:07
-
-
Save aforlorncat1/8edcb4ab7c62fe3db498 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| # 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