DEV Community

0R1
0R1

Posted on

RECURSION

Hello Good Day! just wanted to ask something about about recursion using python, what's the difference between having a return on recursive function and not just like this.

with return on recursive fucntion.
def fib(n):
if n == 0:
return 1
else:
return n * fib(n-1)

without return on recursive function
def n_to_1(n):
if n == 0:
return
else:
print(n)
n_to_1(n-1)

Top comments (0)