From 99a0c5f037ea130f78bdb9073eecb0e10decd120 Mon Sep 17 00:00:00 2001 From: XiaoleTao Date: Sun, 15 Jun 2014 17:59:25 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E9=94=99=E8=AF=AF=E7=9A=84?= =?UTF-8?q?=E6=A0=87=E7=82=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- chapter1/02_a_swift_tour.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/chapter1/02_a_swift_tour.html b/chapter1/02_a_swift_tour.html index 27eadaf3..3a50b7fb 100644 --- a/chapter1/02_a_swift_tour.html +++ b/chapter1/02_a_swift_tour.html @@ -829,7 +829,7 @@ hasAnyMatches(numbers, lessThanTen) })
-

练习:
重写闭包,对所有奇数返回 0.

+

练习:
重写闭包,对所有奇数返回0。

有很多种创建闭包的方法。如果一个闭包的类型已知,比如作为一个回调函数,你可以忽略参数的类型和返回值。单个语句闭包会把它语句的值当做结果返回。

numbers.map({ number in 3 * number })