(1)外部参数名可以在函数调用的时候对于参数有更加直观的认识。即该参数名对外部可见。
import Foundation func sayHello(username name:String)->String{ let result = "Hello," + name return result } var nickname:String = "Jack" println(sayHello(username: nickname))
同时可以使某个参数名同时是内部参数名和外部参数名:使用#号。
import Foundation func sayHello(#name:String)->String{ let result = "Hello," + name return result } var nickname:String = "Jack" println(sayHello(name: nickname))