Share & grow the world's code base!

Delve into a community where programmers unite to discover code snippets, exchange skills, and enhance their programming proficiency. With abundant resources and a supportive community, you'll find everything essential for your growth and success.

1 snippets
  • Example of recursion in golang

    package main
    import "fmt"
    func factorial(n int) int {
    	if n == 0 {
    		return 1
    	return n * factorial(n-1)
    func main() {
    // $ go run main.go 
    // 120

    Recursion in Go using the example of factorial calculation.