What does “…” mean when next to a parameter in a go function declaration?

后端 未结 3 1833
旧巷少年郎
旧巷少年郎 2020-12-09 09:17

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 ...inte         


        
3条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2020-12-09 09:49

    They are variadic functions. They accept a variable number of arguments.

    • Wikipedia: Variadic Functions
    • Go By Example: Variadic Functions

提交回复
热议问题