我在Swift的Declarations
点击了这个链接:https://developer.apple.com/library/content/documentation/Swift/Conceptual/Swift_Programming_Language/Declarations.html
并且其中一条线说A parameter has a name, which is used within the function body, as well as an argument label, which is used when calling the function or method. By default, parameter names are also used as argument labels.
即
(argument label) (parameter name): (parameter type)
使用argument label
传递此函数中的参数,并使用参数名称在函数中使用变量
如果功能
func foo(someVar abc: String)
{
print(a)
}
我们使用foo(someVar: "hello world!")
称呼它。
我想了解提供此类编程构造背后的可能原因