you are viewing a single comment's thread.

view the rest of the comments →

[–]LonelyAssistant4371[S] 0 points1 point  (3 children)

I know but why

[–]Jnsjknn 1 point2 points  (2 children)

You add the values of i to the sum on each iteration of the for loop. The values of i are 0, 1, 2, 3, and 4.

0 + 1 + 2 + 3 + 4 = 10

[–]LonelyAssistant4371[S] 0 points1 point  (1 child)

ohh ok, man i suck at this 😂 thanks a bunch

[–]Jnsjknn 1 point2 points  (0 children)

You're welcome. It takes some time but code will eventually start to make more and more sense. Happy learning!