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

Function fact

GolangBasics/GoByExample/016Recursion.go:5–10  ·  view source on GitHub ↗
(n int)

Source from the content-addressed store, hash-verified

3import "fmt"
4
5func fact(n int) int {
6 if n == 0 {
7 return 1
8 }
9 return n * fact(n-1)
10}
11
12func main() {
13 fmt.Println(fact(7))

Callers 1

mainFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected