import UIKit
class ViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
let s1 = myCode(s: "Before", x: 0)
let s2 = self.myCode2(s: "Before")
let s3 = self.myCode6()
let s4 = self.myCode6(first: 100, secon: "200")
}
// -> 右边是返回值类型, Any 任意类型
func myCode(s:String,x:Int) -> Any {
return (s,x) //返回一个元组
}
//多个返回值
func myCode3(s:String) -> (a:Int,c:String,b:Bool) {
return (0,"多个返回值",true)
}
//返回指定类型
func myCode2(s:String) -> String {
return s+"end" //返回一个字符串
}
//无参,无返回值
func myCode4() {
print(myCode2(s: "无参,无返回值"))
}
//无标签参数
func myCode5(_:Int,_:String) -> Any {