github.com/traefik/yaegi@v0.15.1/_test/variadic3.go (about) 1 package main 2 3 import "fmt" 4 5 func f(a ...int) int { 6 fmt.Println(a) 7 res := 0 8 for _, v := range a { 9 res += v 10 } 11 return res 12 } 13 14 func main() { 15 fmt.Println(f(1, 2, 3, 4)) 16 } 17 18 // Output: 19 // [1 2 3 4] 20 // 10