feat(go): add forLoopRecur func (#816)

This commit is contained in:
Nepenthe
2023-10-07 21:47:58 +08:00
committed by GitHub
parent ef87bd494a
commit 61e1d1faec
2 changed files with 25 additions and 0 deletions

View File

@@ -15,6 +15,9 @@ func TestRecursion(t *testing.T) {
res := recur(n)
fmt.Println("\n递归函数的求和结果 res = ", res)
res = forLoopRecur(n)
fmt.Println("\n使用迭代模拟递归求和结果 res = ", res)
res = tailRecur(n, 0)
fmt.Println("\n尾递归函数的求和结果 res = ", res)