Imagine you wanna know the result of 5^3.
So, you use:
In the first time the argument's values is:
As total > 1, the function doesn't returns. So, it calls itself again, but now it pass:
The recursive function does it until total <=1.
So, the last occurence of the function is when total == 1. Then, it return the base. But when it was called, we got:
|
return (base * recursive(5, 1));
|
As the base is returned, we got:
return( base * base)
Which in turn, it wil return for itself, but now:
return (base * (base * base))
And the function does it until the first call, when it return the value for you.
I don't know if I could explain clearly, but that's it. :)