Here it says, \"Note: the _ means “I don’t care about that value”\", but coming from JavaScript, I don\'t understand what that means.
The only way I can
func divmod(_ a: Int, _ b:Int) -> (Int, Int) {
return (a / b, a % b)
}
func divmod(a: Int, b:Int) -> (Int, Int) {
return (a / b, a % b)
}
The _ is a placeholder for the parameter name. In your example, you call them differently, in the second function, you need to write the parameter name a: 1.
Swift's function name convention is funcName(param1:param2:), and it needs the _ as a placeholder to create the name of the function.
In the first name, the name is
divmod(_:_:)
Whereas the second is
divmod(a:b:)