我想声明一个类型为closure的局部变量,我该怎么办?
答案 0 :(得分:1)
var myClosure: (myParamaterTypes) -> myReturnTypes
例如:
var myClosure: (Int, Int) -> Int // type is (Int, Int) -> Int
myClosure = {(integer01: Int, integer02: Int) -> Int in return integer01 + integer02}