Skip to content

Instantly share code, notes, and snippets.

@Ahnita Ahnita/Each.rb
Last active Aug 29, 2015

Embed
What would you like to do?
Data Structures
def fav_foods
food_array = []
3.times do
puts "Name a favorite food."
food_array << gets.chomp
end
p food_array
puts "Your favorite foods are #{food_array.join(",")}."
food_array.each do |food|
puts "I like #{food} too!"
end
end
fav_foods
def fav_foods
food_array = []
3.times do
puts "Name a favorite food."
food_array << gets.chomp
end
p food_array
puts "Your favorite foods are #{food_array.join(",")}."
end
fav_foods
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.