Last active
April 28, 2018 21:53
-
-
Save regularberry/04b615fab4d040e852c7d531746c7fa9 to your computer and use it in GitHub Desktop.
Not the right nil
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var dict: [String: Any?] = ["first": nil, "second": 2] | |
if let val = dict["first"] { | |
print(val) | |
} | |
// Output: nil | |
dict["first"] = nil | |
if let val = dict["first"] { | |
print(val) | |
} | |
// No output |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment