Created
October 19, 2016 20:28
-
-
Save kajatiger/6d4056f8ba3d726ca7a5abad6eecaee2 to your computer and use it in GitHub Desktop.
iterating through favorite foods
This file contains 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
def fav_foods | |
food_ary = Array.new | |
3.times do | |
puts "name a favorite food" | |
food_ary << gets.chomp | |
food_ary.each do |food| | |
puts "I like #{food} too!" | |
end | |
end | |
puts "your favorite foods are #{food_ary.join(", ")}." | |
end | |
fav_foods |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment