Variadic functions
can be called with any number of trailing arguments.
For example, |
|
|
|
|
|
Here’s a function that will take an arbitrary number
of |
|
Within the function, the type of |
|
|
|
Variadic functions can be called in the usual way with individual arguments. |
|
If you already have multiple args in a slice,
apply them to a variadic function using
|
|
|
|
Another key aspect of functions in Go is their ability to form closures, which we’ll look at next. |
Next example: Closures.