Can you explain this recursive function? : <p>I recently bumped into a factorial project where I have to build a function which simulates the factorial process which is demonstrated in the example below: take an integer n and calculate n! = n x (n−1) x (n−2) x (n−3) ⋅⋅⋅⋅ x 3 x 2 x 1. The exercise asks to use a function to do this.
I obviously got stuck and googled a solution to better understand this problem. That didn't exactly work and I got stuck with a new concept I can barely understand which is recursion.
Here the solution I googled:</p>

<pre><code>def factorial_recursive(n):
    if n == 1:
        return 1

    # Recursive case: n! = n * (n-1)!
    else:
        return n * factorial_recursive(n-1)
</code></pre>

<p>What I want to understand is what happens in the second branch
Also, given this example test:</p>

<pre><code>&gt;&gt;&gt; factorial_recursive(5)
120
</code></pre>

<p>Why do the return values accumilate into one?
It was not specified in the function body. 
All I know is that a function is calling itself based on certain conditions but how does this work exactly. And if so wouldn't that loop forever? Is the n value changing or not because it seems so even if its not so obvious when I look at the code but the resuts show otherwise. And why are the multiple return values stacked into one?
I hope my questions can be answered and any linked docs or duplicates are appreciated if there are any.</p>
