Code on a screen, representing a tail call.

A function call that is the last thing a function does.

What a tail call is

A tail call is a function call that is performed as the very last action of a function. In other words, when a function's final step is to call another function and return its result, that call is in tail position. This specific situation is important because it enables an optimization that can make certain programs more efficient in how they use memory.

The last action of a function

What distinguishes a tail call is its position: it is the last thing the function does before returning. There is no further work to do after the call returns, because the function simply hands back whatever the call produces. This is different from a call whose result is used in further computation, which would not be a tail call since more work follows.

Tail-call optimization

Because a tail call is the last action, the calling function has nothing left to do once the call is made. This means the memory used to keep track of the calling function can, in principle, be reused for the called function rather than kept around. This reuse is known as tail-call optimization, and it can reduce the memory a program uses during such calls.

Why it matters for recursion

Tail calls are especially relevant to recursion, where a function calls itself. Normally, deep recursion can use a lot of memory, since each call adds to the record of ongoing calls. If the recursive call is a tail call and the language optimizes it, the memory can be reused, allowing deep or even unbounded recursion without running out of space. This makes recursive solutions more practical.

Support across languages

Whether tail-call optimization happens depends on the language and its implementation. Some languages guarantee it, making tail-recursive solutions efficient, while others do not. Understanding tail calls clarifies why a recursive function might be written to end with a tail call, and why that detail can matter for how efficiently the program runs.

Why it matters

The tail call is an important concept in programming languages. Understanding what it is - a function call made as the last action of a function, enabling an optimization - clarifies how recursion can be made efficient. For anyone interested in programming languages, it is a valuable concept to understand.

See also: What is recursion? Explained, What is the stack in memory? Explained.

Sources

Published date reflects the original event date (2026-08-18). This article is original Skillo editorial written from the sources above; facts were verified in September 2026.

Skillo Staff

Skillo Staff

All stories by: Skillo Staff

Leave a Reply