From 00ef4e6c14d625bfa36d7653366393ea98ab4f27 Mon Sep 17 00:00:00 2001 From: huangqiaobo Date: Fri, 5 Sep 2014 18:52:54 +0800 Subject: [PATCH 1/2] fix some typos --- source/chapter1/02_a_swift_tour.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/source/chapter1/02_a_swift_tour.md b/source/chapter1/02_a_swift_tour.md index 622c3a5b..3103c659 100755 --- a/source/chapter1/02_a_swift_tour.md +++ b/source/chapter1/02_a_swift_tour.md @@ -682,10 +682,10 @@ protocolValue.simpleDescription 在尖括号里写一个名字来创建一个泛型函数或者类型。 ```swift -func repeat(item: ItemType, times: Int) -> ItemType[] { - var result = ItemType[]() - for i in 0..times { - result += item +func repeat(item: ItemType, times: Int) -> [ItemType] { + var result = [ItemType]() + for i in 0.. Date: Fri, 5 Sep 2014 20:33:59 +0800 Subject: [PATCH 2/2] =?UTF-8?q?1.2swift=E5=88=9D=E8=A7=81=E7=9A=84?= =?UTF-8?q?=E6=B3=9B=E5=9E=8B=E9=83=A8=E5=88=86=E7=9A=84=E6=9C=80=E5=90=8E?= =?UTF-8?q?=E4=B8=80=E5=9D=97=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- source/chapter1/02_a_swift_tour.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/chapter1/02_a_swift_tour.md b/source/chapter1/02_a_swift_tour.md index 3103c659..cdf4b961 100755 --- a/source/chapter1/02_a_swift_tour.md +++ b/source/chapter1/02_a_swift_tour.md @@ -707,7 +707,7 @@ possibleInteger = .Some(100) 在类型名后面使用`where`来指定对类型的需求,比如,限定类型实现某一个协议,限定两个类型是相同的,或者限定某个类必须有一个特定的父类 ```swift -func anyCommonElements (lhs: T, rhs: U) -> Bool { +func anyCommonElements (lhs: T, rhs: U) -> Bool { for lhsItem in lhs { for rhsItem in rhs { if lhsItem == rhsItem {