Computer Science

Forgetting the Base Case in Recursion

A student writes a recursive function that calls itself again but never handles the simplest input.

Quick check

Why students make it

Students focus on the repeating pattern and assume the function will naturally finish. They forget that recursion needs an explicit stopping condition.

The rule done right

Every recursive function needs at least one base case that returns a result without making another recursive call. The recursive step must move closer to that base case.