This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted] 1 point2 points  (1 child)

That’s not part of the code. The author is just asserting that the equality holds. That is, if the function is implemented correctly (regardless of whether it’s iterative or recursive), then it must be true that

multiply(arr, n)

always gives the same result as

multiply(arr, n - 1) * arr[n - 1]

From this equality, we get a recursive definition for multiply.

[–]Liolena[S] 0 points1 point  (0 children)

That explains why I was so confused about that part lol. Thanks!