Skip to content

Instantly share code, notes, and snippets.

@justuseapen
Created November 25, 2013 14:08
Show Gist options
  • Save justuseapen/7641724 to your computer and use it in GitHub Desktop.
Save justuseapen/7641724 to your computer and use it in GitHub Desktop.
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