diff --git a/source/chapter1/02_a_swift_tour.md b/source/chapter1/02_a_swift_tour.md index 622c3a5b..cdf4b961 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.. (lhs: T, rhs: U) -> Bool { +func anyCommonElements (lhs: T, rhs: U) -> Bool { for lhsItem in lhs { for rhsItem in rhs { if lhsItem == rhsItem {