标签:
所谓闭包,可以理解为一个可以用于函数,参数,返回值处的代码块
import Foundation
func isGood(a:Int,b:Int)->Bool{
return a>b;
}
func addMoney(a:Int,b:Bool)->String{
return "hello";
}
var result=addMoney(15,isGood(3,4))
var myList=["aaa","bbb","ccc"]
sort(&myList,{(s1:String,s2:String)->Bool in return s1>s2})
sort(&myList, {$0>$1})
标签:
原文地址:http://www.cnblogs.com/daochong/p/4825799.html