Skip to content
Latchkey

What Is a Tail Call?

A tail call is a call that occurs as the very last operation of a function, so nothing remains to do after it returns except return its result. Because the caller frame is no longer needed, an implementation can reuse it for the callee rather than pushing a new one. This is the property that enables tail call optimization.

Why it matters

Recognizing tail calls lets compilers turn recursion that would overflow the stack into loop-like iteration. It is the basis for writing deep recursive algorithms safely in functional styles.

Related guides

Tired of flaky CI? Latchkey auto-heals failed jobs and retries them for you. Start free →