No problem with my code but I’m confused by this example:
numbers = [5, 2, 8]
sum = 0
numbers.each do |n|
sum += n
“The example above is just a reminder about syntax. We calculate the sum of a list of numbers.”
What is the purpose of sum = 0?
I assume that sum += n is adding all the numbers together to give us the final sum, but what does sum = 0 do?