Half of the parameters in SWIFT are defined as follows:

Func funcName (parameter) -> returnType {Statement1 Statement2...... Statement Nreturn parameters
}
Copy the code

example

func runoob(site: String) -> String {
    return (site)
}
print(runoob(site: "WWW. Baidu. Com"))
Copy the code

With a default value

Func addName(name1:String,name2 :String, P :String ="stop") {print("\(name1) and \(name2) are \(P)")}Copy the code

For more information, please click the home page…

Jane: www.jianshu.com/u/88db5f157…

csdn:me.csdn.net/beyondforme

The Denver nuggets: juejin. Cn/user / 782508…