2020-01-15 [Golang] Sum func 870 0 Golang 2020-01-17 Golang sum func Sum func func main() { ii := []int{1, 2, 3, 4, 5, 6, 7, 8, 9} s := sum(ii...) fmt.Println(s) } func sum(xi ...int) int { fmt.Printf("%T\n", xi) total := 0 for _, v := range xi { total += v } return total } End Golang 回首頁