📜  golang 遍历切片 - Go 编程语言 - Go 编程语言代码示例
📅  最后修改于: 2022-03-11 14:45:02.763000             🧑  作者: Mango
代码示例2
nums := []int{2, 3, 4}
sum := 0
for _, num := range nums {
sum += num
}
fmt.Println("sum:", sum)