簡體   English   中英

如何聲明一個快速關閉的局部變量

[英]How to declare a local variable that is a closure in swift

我想聲明一個封閉類型的局部變量,我該怎么做?

var myClosure: (myParamaterTypes) -> myReturnTypes

例如:

var myClosure: (Int, Int) -> Int  // type is (Int, Int) -> Int
myClosure = {(integer01: Int, integer02: Int) -> Int in return integer01 + integer02}

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM