What does this code do?


#1

I got the code to work, but I don't understand how it works or what it means? Please help!
This is my code:

favorite_things = ["Ruby", "espresso", "candy", "Ruby"]

puts "A few of my favorite things:"

favorite_things.each do |thing|
puts "I love #{thing}!"
end


#2

Which part specifically don't you understand?


#3

I don't exactly get what it does. I completed the lesson, but I'm just confused on what it means.


#4

For each element in the array, it says "I love #{thing}"
The output should be
I love Ruby
I love espresso
I love candy
I love Ruby

A while ago you did the same basic thing with do's and ends and curly braces ( { | a | puts a } ).