Swift4.0 函数参数(内部外部参数和下划线在函数的作用)

2019-01-15 15:30:39 浏览数 (1)

代码语言:javascript复制
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)
    }


}

0 人点赞