Advertisement
Guest User

Untitled

a guest
Jul 20th, 2017
46
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.43 KB | None | 0 0
  1. def fav_foods
  2. food_array = [] # code for this method goes in here
  3. 3.times do
  4. puts "Name a favorite food."
  5. food_array << gets.chomp
  6. end
  7. puts "Your favorite foods are #{food_array.join(", ")}."
  8. p food_array
  9. food_array.each do |food| # do something to each element in food_array; that element is to be referred to as food
  10. puts "I like #{food} too!" # the thing we're doing
  11. end # ends the loop
  12. end
  13. fav_foods
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement