swift - cannot create variadic tuple -
i have following functions
func func1(str1: (string...),str: string){ //wrong 1 error "cannot create variadic tuple" } func func1((str1:string...),str: string){ //wrong 1 error "cannot create variadic tuple" }
it shows error "cannot create variadic tuple" when try write above code..but works when try change parameter place below
func func1(str: string,str1: (string...)){ //right 1 } func func1(str: string,str1: string...){ //right 1 }
i changed parameter place , can me understand doing wrong ?
variadic paramter must last parameter of function. swift documentation:
a function may have @ 1 variadic parameter, , must appear last in parameter list, avoid ambiguity when calling function multiple parameters.
Comments
Post a Comment