Skip to content

Commit 589dd73

Browse files
committed
Fixes example snippets in Dictionary.swift
1 parent 34db631 commit 589dd73

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

stdlib/public/core/Dictionary.swift

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -273,7 +273,7 @@
273273
/// }
274274
/// }
275275
/// // Prints "Response 200: OK"
276-
/// // Prints "Response 403: Access Forbidden"
276+
/// // Prints "Response 403: Access forbidden"
277277
/// // Prints "Unknown response 301"
278278
///
279279
/// You can also update, modify, or remove keys and values from a dictionary
@@ -351,7 +351,7 @@
351351
/// the corresponding key-value pair as a non-optional tuple.
352352
///
353353
/// print(imagePaths[glyphIndex!])
354-
/// // Prints "("star", "/glyphs/star.png")"
354+
/// // Prints "(key: "star", value: "/glyphs/star.png")"
355355
///
356356
/// A dictionary's indices stay valid across additions to the dictionary as
357357
/// long as the dictionary has enough capacity to store the added values
@@ -696,7 +696,7 @@ extension Dictionary: Collection {
696696
/// } else {
697697
/// print("Didn't find 'Japan' as a value in the dictionary.")
698698
/// }
699-
/// // Prints "("JP", "Japan")"
699+
/// // Prints "(key: "JP", value: "Japan")"
700700
/// // Prints "Japan's country code is 'JP'."
701701
///
702702
/// - Parameter position: The position of the key-value pair to access.
@@ -851,7 +851,7 @@ extension Dictionary {
851851
/// print("Response \(code): \(message)")
852852
/// }
853853
/// // Prints "Response 200: OK"
854-
/// // Prints "Response 403: Access Forbidden"
854+
/// // Prints "Response 403: Access forbidden"
855855
/// // Prints "Response 301: Unknown response"
856856
///
857857
/// When a dictionary's `Value` type has value semantics, you can use this
@@ -862,7 +862,7 @@ extension Dictionary {
862862
/// let message = "Hello, Elle!"
863863
/// var letterCounts: [Character: Int] = [:]
864864
/// for letter in message {
865-
/// letterCounts[letter, defaultValue: 0] += 1
865+
/// letterCounts[letter, default: 0] += 1
866866
/// }
867867
/// // letterCounts == ["H": 1, "e": 2, "l": 4, "o": 1, ...]
868868
///
@@ -933,7 +933,7 @@ extension Dictionary {
933933
/// let data = ["a": "1", "b": "three", "c": "///4///"]
934934
///
935935
/// let m: [String: Int?] = data.mapValues { str in Int(str) }
936-
/// // ["a": 1, "b": nil, "c": nil]
936+
/// // ["a": Optional(1), "b": nil, "c": nil]
937937
///
938938
/// let c: [String: Int] = data.compactMapValues { str in Int(str) }
939939
/// // ["a": 1]
@@ -1183,7 +1183,7 @@ extension Dictionary {
11831183
/// If the key isn't found in the dictionary, `removeValue(forKey:)` returns
11841184
/// `nil`.
11851185
///
1186-
/// if let value = hues.removeValueForKey("Cerise") {
1186+
/// if let value = hues.removeValue(forKey: "Cerise") {
11871187
/// print("The value \(value) was removed.")
11881188
/// } else {
11891189
/// print("No value found for that key.")

0 commit comments

Comments
 (0)