package main
import "fmt"
func main() {
fmt.Println("Sum 1:", Sum(1, 2))
fmt.Println("Sum 2:", Sum(10, 2, -6, 3))
fmt.Println("Sum 3:", Sum(-7, 3, 8))
}
func Sum(parameters ...int) int {
fmt.Println("Size:", len(parameters))
s := 0
for _, parameter := range parameters {
s += parameter
}
return s
}
Output
Size: 2
Sum 1: 3
Size: 4
Sum 2: 9
Size: 3
Sum 3: 4