/deaf_aunty.rb Secret
Last active
January 12, 2016 09:45
-
-
Save SeokSeth/a941b6be4aec7864b88a 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 | |
| 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