基本类型的值,对象,数组,字典,元组,可变数量的参数,函数,闭包函数,协议,结构体,枚举值
2.怎么定义参数
a....func calculate(a:(Int,Int)->Int){// 定义的参数为函数的函数
a(2,1)// 执行函数
}
calculate(a: add);// 执行函数
g.上面函数的闭包写法...swapTwoInts
// 建议还是用下面这种
var swap1:( inout Int, inout Int)->Void = swapTwoInts
定义闭包类型数据
var customersInLine...4
提示:上面那种闭包其实是五参有返的闭包形式,原形如下
let customerProvider:()->String= { customersInLine.remove(at: 0)}
关键字...,我们有可能暂时不要把这个闭包存放在数组中,或者使用属性去引用它,那么这个时候就需要使用这个关键了
修改代码
var downloadComplate:((Bool)->())
func downloadResource