swift func: i can't understand underscore as a parameter name that can compile -
how use underscore parameter
func test(currentname name: string, _: int) { print("aa\(name) abc"); //how use _ parameter? } test(currentname:"aa", 3)
_
means when call test
function, don't have write text before second parameter test(currentname:"aa", 3)
if declare function this:
func test(currentname name: string, secondparameter: int) { print("aa\(name) abc"); //how use _ parameter? }
then when call test
function, must call this:
test(currentname:"aa", secondparameter: 3)
Comments
Post a Comment