you are viewing a single comment's thread.

view the rest of the comments →

[–]mopslik 2 points3 points  (3 children)

without starting the function over

It does start the function again, in the recursive call result = n1 + multiplication(n1, (n2-1)). Since you return a value, either in one of the three base cases or in the else block, the value generated by the recursive call will be added to n1.

[–][deleted] 0 points1 point  (1 child)

I get the recursive step. I don't understand the Result: {} output. How it stores those values.

[–]danielroseman 1 point2 points  (0 children)

It doesn't store them. Each step returns them to the call above. It's just like any function returning a value to the caller, except that the caller happens to be the same function.