MCPcopy Create free account
hub / github.com/Go-Learning-Land/Go-Learning-Archive / main

Function main

GolangBasics/GoByExample/016Recursion.go:12–26  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

10}
11
12func main() {
13 fmt.Println(fact(7))
14
15 var fib func(n int) int //nice case for declaration function to variable
16
17 fib = func(n int) int {
18 if n < 2 {
19 return n
20 }
21 return fib(n-1) + fib(n-2)
22
23 }
24
25 fmt.Println(fib(7))
26}

Callers

nothing calls this directly

Calls 2

factFunction · 0.85
PrintlnMethod · 0.80

Tested by

no test coverage detected