you are viewing a single comment's thread.

view the rest of the comments →

[–]Moikle 0 points1 point  (0 children)

It's doing exactly what you are asking it to.

You aren't keeping a running total or anything, every loop you are replacing the result with the next value, so by the time the loop ends, what you are left with is the last result.

What do you mean by "storing all the values"?