标签:class main func col pre style print 递归函数 int
求1-10的和
func sum(num int) int { if num == 1 { return 1 } return sum(num-1) + num } func main() { ret := sum(10) fmt.Println(ret) }
标签:class main func col pre style print 递归函数 int
原文地址:https://www.cnblogs.com/Nolover/p/12576452.html