Recursion
Defination
Function calling itself is recursion.
Liegh Caldwell
Loops may achieve a performance gain for your program. Recursion may achieve a performance gain for your programmer. Choose which is more important in your situation!
Note
Each call to a function is held in Stack is called a call stack.
Example
def fact(n):
# Error case
if n < 0:
print("error)
# Base case
if n == 0:
return 1
# Recusive case
else:
return n * fact(n-1)
Seealso