函数
import UIKit
class ViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
// print(firstFuns("小明", "18"))
print(firstFuns())
print(firstFuns(name: "小明", age: "30"))
print(firstFuns(name: "小仙女"))
// Do any additional setup after loading the view, typically from a nib.
}
//创建有参有返回的方法
func firstFuns(name:String = "小霞霞",age:String = "18") -> String {
return name + age
}
func firstFuns(_ name:String,_ age:String) -> String {
return name + age
}
func firstFuns(Str1 name:String,Str2 age:String) -> String {
return name + age
}
//函数的无返回值形式
func demo() {
}
func demo1() -> () {
}
func demo2() -> Void {
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
}
网友评论