基本上,函数是递归的
- 函数具有简单的基本情况,何时
- 所有其他情况都有规则化简为基本情况。
例如,要计算阶乘:
public static long factorial(int i){ // This is the base case if(i == 0) { return 1; } else { // This reduces the problem to something closer to the base case return i * factorial(i - 1); }}


