nightingale1/vendor/github.com/toolkits/pkg/slice/sum.go

23 lines
275 B
Go
Raw Normal View History

2020-09-26 17:02:52 +08:00
package slice
func SumInt64(s []int64) (sum int64) {
for _, v := range s {
sum += v
}
return
}
func SumInt(s []int) (sum int) {
for _, v := range s {
sum += v
}
return
}
func SumFloat64(s []float64) (sum float64) {
for _, v := range s {
sum += v
}
return
}