The _
is used to define that the parameter is not named
If you have multiple _
it states that you do not need to name the parameters in your function call
func myFunc(name:String, _ age:String){
}
myFunc(“Milo", "I'm a really old wizard")
If you do not use the underscore you would use
myFunc(“Milo”, age: "I'm a really old wizard")
The _
is not necessary for function calls. It is just used to indicate that something does not need to have a name.
In regards to how you would refer to your function, You would not have to pass any name for the function call.
But since you also don’t define a parameter type this seems to me like an invalid example (it at least doesn’t work in Xcode 7 with Swift 2.0)
Edit:
Since Swift 3.0
myFunc(name: “Milo”, age: "I'm a really old wizard")
Should be used
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…