In the example we pass a slice of integers to the Sum function:
package main
import "fmt"
func main() {
vals := []int{1, 2, 3, 4, 5, 6, 7}
fmt.Println(Sum(vals...))
}
func Sum(n ...int) int {
sum := 0
for _, n := range n {
sum += n
}
return sum
}