I've read about variadic functions :
The final parameter in a function signature may have a type prefixed with
...
. A function with such a parameter is called variadic and may be invoked with zero or more arguments for that parameter.
Translated:
The final parameter in a function signature can have a type prefixed with
...
. A function with such a parameter is called a variadic and can be called with zero or more arguments to that parameter.
So, it is valid:
func Zoológico(ación string, animales ...string) {
// ...
}
But what will be the type of animales
? Is it a string
, or []string
, or something else "special"?
The type of the parameter specified with
...T
shall be of type[]T
as specified in the Passing arguments to ... parameters section :The original version of this paragraph reads: