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,