Member-only story

What is the Recursion technique? Write Factorial program | Learn DSA

Ankit Maheshwari
3 min readMar 31, 2022

--

Recursion is a process of calling itself. A function that calls itself is called a recursive function.

My articles are open for everyone; non-member readers can read the article by clicking this Friend link.

Example: If we place two parallel mirrors facing each other, an object in between two mirrors would be reflected recursively. In the same way, a recursive function is a function that calls itself.

Syntax to define a recursive function:

But, a recursive function must have a condition to stop calling itself. Otherwise, the function will end up in an infinite recursion loop.

Base condition: Once the condition is met, the function stops calling itself, this is called a base condition.

--

--

Ankit Maheshwari
Ankit Maheshwari

Responses (1)