# Recursion

*noun*

say it: **“rih-KUR-zhun”** **/rɪˈkɜrʒən/**

Solving a problem by having a function call itself on a smaller piece of the same problem, until the piece is small enough to answer at once.

## What is **recursion**?

**Recursion** is solving a problem by having a function call itself on a smaller piece of the same problem, like counting a set of nesting dolls by opening one and counting the dolls inside it the same way. Every recursive function has a **base case**, answered straight away, and a **recursive case**, which calls the function again.

## In a sentence

- “I counted the nested folders with **recursion**: the function adds up one folder, then calls itself for each folder inside.”

Level: Apprentice · [More Data Structures terms at this level](https://www.ask-codey.com/glossary?category=data-structures&level=2)

Updated: November 9, 2026

## In other subjects

- [Recursion in C#](https://www.ask-codey.com/glossary/recursion-c-sharp)
- [Recursion in Java](https://www.ask-codey.com/glossary/recursion-java)
- [Recursion in JavaScript](https://www.ask-codey.com/glossary/recursion-javascript)
- [Recursion in Python](https://www.ask-codey.com/glossary/recursion)

Source: https://www.ask-codey.com/glossary/recursion-data-structures
