Created
November 24, 2013 18:20
-
-
Save vanmichael/7630424 to your computer and use it in GitHub Desktop.
Phase 2
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
| #Echo Phase 2 | |
| class Echo | |
| def initialize | |
| get_input | |
| if @input == "Nothing!" | |
| puts "Ok, fine!" | |
| elsif @input == "I have a lot to say" | |
| puts "I don't have time for that right now!" | |
| else | |
| play_back(@input) | |
| end | |
| end | |
| def get_input | |
| puts "What do you want to say?" | |
| @input = gets.chomp | |
| end | |
| def play_back(response) | |
| puts "You said: #{response}" | |
| end | |
| end | |
| Echo.new |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment