scala递归函数
Scala中的递归函数
(
Recursion function in Scala
)
Recursion function
is a function that calls itself again and again until a specific condition becomes true. In functional programming,
recursion
plays a big role and being a functional programming language Scala also supports recursion function.
递归函数
是一次又一次调用自己的函数,直到满足特定条件为止。 在函数式编程中,
递归
起着重要的作用,作为函数式编程语言,Scala也支持递归函数。
So,
Recursion function
is calling the same block of code again till the end condition becomes true. Most programs that require adding or doing some specific calculations multiple times use recursion. It is a better choice instead of an infinite
while loop<