This question already has an answer here:
In the official documentation, codes like the following appear often.
func Printf(format string, a ...interface{}) (n int, err error)
what are a
and ...
mean respectively?
</div>
This question already has an answer here:
In the official documentation, codes like the following appear often.
func Printf(format string, a ...interface{}) (n int, err error)
what are a
and ...
mean respectively?
</div>
a
is a variable, like any other. ...
is a way to grab many arguments into a slice.
It could be written as:
func Printf(format string, a []interface{}) (n int, err error)
but then you'd have to call it like this:
Printf("", []interface{1,2,3})
rather than like this
Printf("", 1, 2, 3)