Go Example--递归
package main
import "fmt"
func main() {
fmt.Println(fact(7))
}
//函数的递归
func fact(n int) int {
if n == 0{
return 1
}
return n*fact(n-1)
}
package main
import "fmt"
func main() {
fmt.Println(fact(7))
}
//函数的递归
func fact(n int) int {
if n == 0{
return 1
}
return n*fact(n-1)
}