
上QQ阅读APP看书,第一时间看更新
Benefits of tail-recursion
Apart from the preceding linear recursion benefits we discussed previously, it gives us the following benefits too:
- Uses very few stack-frames for tail-recursive calls
- Consumes less memory
- No more StackOverflowException issues
Unlike Java, which supports only the standard recursive approach, Scala supports both recursion and tail-recursion approaches.