Created
November 25, 2013 14:08
-
-
Save justuseapen/7641724 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
puts "What would you like to say?" | |
phrase = gets.chomp | |
def lots_to_say | |
phrases = [] | |
puts "Ok, let's hear it!" | |
input = "" | |
while input != "done" | |
input = gets.chomp | |
if input == "done" | |
break | |
else | |
phrases << input | |
end | |
end | |
phrases.each do |phrase| | |
if phrase == phrases[0] | |
puts "You said: #{phrase}" } | |
elsif phrase == phrases.last | |
puts "Finally you said: #{phrases.last}" | |
else | |
puts "Then, you said: #{phrase}" | |
end | |
puts "Phew! I'm glad you got all #{phrases.length} of those things off your chest!" | |
end | |
def playback(phrase) | |
if phrase == "Nothing!" | |
puts "OK, fine!" | |
elsif phrase == "I have a lot to say." | |
lots_to_say | |
else | |
puts "You said: #{phrase}" | |
end | |
end | |
playback(phrase) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment