Hi,

I have an array and the length of this array is dynamic. I want to pass 
this array's values as a list of parameters to a function. Can you please 
suggest what is a good way to do this?


For example,  func(query string, args ...interface{}). My array is 
arrayExample := []string {"1", "a", "b", "2"}. Then it will be something 
like func(query, arrayExample[0], arrayExample[1], arrayExample[2], 
arrayExample[3]).

If my array is  arrayExample := []string {"1", "a"}. Then it will be 
something like func(query, arrayExample[0], arrayExample[1])

But as I mentioned the array is dynamic so the length can be any number. I 
can get the length, but how can I pass each member in the array to the 
function call as a list of parameters?

Thanks a lot!

Regards,

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/f6731237-4b66-47ce-ab8c-611a93be942b%40googlegroups.com.

Reply via email to