Answer the question
In order to leave comments, you need to log in
Is it possible to make a function that returns an indefinite number of values?
Hi all. In general, there is a function from the vendor that takes an indefinite number of arguments, such as
func NewFoo(bar ...int) *FooType {
return Foo
}
Answer the question
In order to leave comments, you need to log in
Sorry, at first I misunderstood the question, I thought that you need to return an indefinite number of values.
To send a slice as a set of values to a function that accepts an indefinite number of values, you need to do this:
https://play.golang.org/p/r98qBIvCC8
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question