What does this print?
var m = ["a": 4, "b": 6]
print(m["c", default: 8])
m["a", default: 0] += 1
print(m["a"]!)
Try it in the online Swift Playground →
[spoiler title="Solution"]
Answer:
8 5
Explanation:
The `default` parameter provides a fallback value for missing keys. It works for both reading (`m["c", default: 8]` returns 8) and write-through updates.
[/spoiler]