Swift4.0 函式引數(內部外部引數和下劃線在函式的作用)

ZY_FlyWay發表於2018-02-22
import UIKit

class ViewController: UIViewController {

    override func viewDidLoad() {
        super.viewDidLoad()
        funcDemo1(arg1: 2, arg2: 3)
        funcDemo2(a: 5, b: 2)
        funcDemo3(2, arg2: 3)
    }

    override func didReceiveMemoryWarning() {
        super.didReceiveMemoryWarning()
    }


    func funcDemo1(arg1 a:Int,arg2 b:Int){
        print(a+b)
    }

    func funcDemo2(a:Int,b:Int){
        print(a+b)
    }

    func funcDemo3(_ a:Int,arg2 b:Int){
        print(a+b)
    }


}

相關文章