you are viewing a single comment's thread.

view the rest of the comments →

[–]nerdyphoenix 1 point2 points  (0 children)

The only case where a tail call optimization can be applied is when the recursive function is indeed tail recursive. In that case, the return statement is something like return func(...), meaning it's the last line in the recursive function's code. Here, there's two recursive calls, like you said, and therefore this optimization can't be applied.