## Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community!

### Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.  # I got lost.

Okay so I followed what was being said until he ran the print statement and got 2, 6, and 14. I understand what the for statement means but i don't understand how he got the sums from the for expression.

Hey Roger,

In the example they use 'sum += many[i];' so as the loop runs through the array, it adds the values.

eg:

• i = 0 sum += many 2 - (value at index 0 is 2 + sum which is 0 = 2 which is now set to the value of sum)
• i = 1 sum += many 6 - (value at index 1 which is 4 + sum which is now 2 = 6)
• i = 2 sum += many 14 - (value at index 2 is 8 + sum which is 6 = 14)

I hope that helps

No problem guys. Glad I could help.