fix some error code

This commit is contained in:
lifeng
2015-07-24 23:58:56 +08:00
parent 7edc0faa57
commit 19cfcda5db

View File

@ -361,7 +361,7 @@ favoriteGenres.insert("Jazz")
```swift ```swift
if let removedGenre = favoriteGenres.remove("Rock") { if let removedGenre = favoriteGenres.remove("Rock") {
print("\(removedValue)? I'm over it.") print("\(removedGenre)? I'm over it.")
} else { } else {
print("I never much cared for that.") print("I never much cared for that.")
} }
@ -456,7 +456,7 @@ let farmAnimals: Set = ["🐮", "🐔", "🐑", "🐶", "🐱"]
let cityAnimals: Set = ["🐦", "🐭"] let cityAnimals: Set = ["🐦", "🐭"]
houseAnimals.isSubsetOf(farmAnimals) houseAnimals.isSubsetOf(farmAnimals)
// true // true
farmAnimals.isSuperSetOf(houseAnimals) farmAnimals.isSupersetOf(houseAnimals)
// true // true
farmAnimals.isDisjointWith(cityAnimals) farmAnimals.isDisjointWith(cityAnimals)
// true // true
@ -495,7 +495,7 @@ Swift 的字典使用`Dictionary<Key, Value>`定义,其中`Key`是字典中键
我们可以像数组一样使用构造语法创建一个拥有确定类型的空字典: 我们可以像数组一样使用构造语法创建一个拥有确定类型的空字典:
```swift ```swift
var namesOfIntegers = [Int: String] var namesOfIntegers = [Int: String]()
// namesOfIntegers 是一个空的 [Int: String] 字典 // namesOfIntegers 是一个空的 [Int: String] 字典
``` ```