What is _: in Swift telling me?

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

Leave a Comment