v4 / vlib / v / checker / tests / function_variadic_arg_array_decompose.vv
12 lines · 11 sloc · 142 bytes · 7a6fd359d08474adeb36925bdcee31daac7d9e28
Raw
1fn sum(a ...int) int {
2 mut total := 0
3 for x in a {
4 total += x
5 }
6 return total
7}
8
9fn main() {
10 b := [5, 6, 7]
11 println(sum(1, 2, ...b))
12}
13