Code
Hub
Workspaces
Following
Trending
Connect
MCP
copy
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
3
import
"fmt"
4
5
func
fact(n int) int {
6
if
n == 0 {
7
return
1
8
}
9
return
n * fact(n-1)
10
}
11
12
func
main() {
13
fmt.Println(fact(7))
Callers
1
main
Function · 0.85
Calls
no outgoing calls
Tested by
no test coverage detected