Variadic (...)
Takes a variable number of arguments.
Syntax
func name(numbers ...int) { }Description
...type gathers an arbitrary number of arguments into a slice.
Example
Loading editor…
Expected output
10
When to use?
Indeterminate number of arguments (addUp, concatenate).