I was going through some code written in Google’s Go language, and I came across this:
func Statusln(a ...interface{})
func Statusf(format string, a ...interface{})
I don’t understand what the ... means. Does anybody know?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
It means that you can call Statusln with a variable number of arguments. For example, calling this function with:
Will assign the parameter a the following value:
So, you can iterate over this slice a and process all parameters, no matter how many there are. A good and popular use-case for variadic arguments is for example fmt.Printf() which takes a format string and a variable number of arguments which will be formatted according to the format string.