Explain recursion with a simple example

The short version: recursion refers to a technique where a function solves a problem by calling itself on a smaller input. A quick example makes it concrete — Factorial of 5 unfolds as 5 × 4 × 3 × 2 × 1 = 120.

How to approach it step by step

Once one example makes sense, the method generalises: define the base case first, then express the general case in terms of it. In a visual interactive session the example is built on screen piece by piece, so you see which quantity changes at each step instead of only reading a final answer. Ask for a harder variant and the explanation adapts on the spot.

Worked example

Factorial of 5 unfolds as 5 × 4 × 3 × 2 × 1 = 120.

The mistake most learners make

Writing a recursive call with no reachable base case, causing infinite recursion.

Still not clear? Get it taught live, 1:1

LetMeTeach explains this on a live visual board, speaks it aloud, answers your follow-up questions instantly and switches language whenever you want — English, Hindi, Telugu and more.

recursion, recursion explained, recursion computer science, recursion doubt solved, recursion step by step, visual explanation of recursion, real time 1:1 teaching for recursion, recursion in simple words