简单递归,阶乘计算递归有两个部分: 基线条件:函数不再调用自己,避免无限循环 递归条件:函数调用自己 123456789fun fact(x:Int):Int{//基线条件 if(x==1){ return 1 } //递归条件 return (x*fact(x-1))} ← Previous post Next post → Tags 算法