MCPcopy Create free account
hub / github.com/derekbanas/Go-Tutorial / factorial

Function factorial

hellogo.go:279–285  ·  view source on GitHub ↗

----- RECURSION -----

(num int)

Source from the content-addressed store, hash-verified

277
278// ----- RECURSION -----
279func factorial(num int) int {
280 // This condition ends calling functions
281 if num == 0 {
282 return 1
283 }
284 return num * factorial(num-1)
285}
286
287// When a Go program executes it executes a function named main
288// Go statements don't require semicolons

Callers 1

mainFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected