Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def fav_foods
- food_array = [] # code for this method goes in here
- 3.times do
- puts "Name a favorite food."
- food_array << gets.chomp
- end
- puts "Your favorite foods are #{food_array.join(", ")}."
- p food_array
- food_array.each do |food| # do something to each element in food_array; that element is to be referred to as food
- puts "I like #{food} too!" # the thing we're doing
- end # ends the loop
- end
- fav_foods
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement