fix some typos
This commit is contained in:
@ -682,10 +682,10 @@ protocolValue.simpleDescription
|
|||||||
在尖括号里写一个名字来创建一个泛型函数或者类型。
|
在尖括号里写一个名字来创建一个泛型函数或者类型。
|
||||||
|
|
||||||
```swift
|
```swift
|
||||||
func repeat<ItemType>(item: ItemType, times: Int) -> ItemType[] {
|
func repeat<ItemType>(item: ItemType, times: Int) -> [ItemType] {
|
||||||
var result = ItemType[]()
|
var result = [ItemType]()
|
||||||
for i in 0..times {
|
for i in 0..<times {
|
||||||
result += item
|
result.append(item)
|
||||||
}
|
}
|
||||||
return result
|
return result
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user