Recursion in python
Which Function called by itself that is recursion Function.In that syntax "Function()" called by itself.But It's iterate the function limited. If it's iterate the function long time may be stackoverflow error happens.
Syntax:
def Function(): Function()
Example-1
def Recursion(n): if(n != 0): print(n) n = n-1 Recursion(n) Recursion(5)
Output
5 4 3 2 1
Example-2
def Recursion(n): if(n != 0): print(n) n = n-1 return Recursion(n) Recursion(5)
Output
5 4 3 2 1