There are times when programmers have to write functions that are recursive, where the critical problem that such functions eat up the entire allocated stack space. To overcome this challenge, Scala provides a “tail recursion” mechanism.

This mechanism optimizes recursive functions so that they do not create new stack space and use the existing stack space.

Suggest An Answer

No suggestions avaliable!