-
-
Notifications
You must be signed in to change notification settings - Fork 121
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Value for a missing key in a map #272
Comments
The not equal to nil is a bug.
I think throwing an error is going to cause more of a headache then it would help. Most of the time just checking for nil will/should work. For the rest of the time, can use ok syntax. |
Map not equal to nil fixed here: |
Thanks for this fix!
Le jeu. 26 juil. 2018 à 18:02, MichaelS11 <[email protected]> a
écrit :
… Map not equal to nil fixed here:
#271 <#271>
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#272 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/ABMh_6iiiFIs8Wl6jDMg3KPnqfB8bE6Aks5uKefzgaJpZM4VhpTY>
.
--
Michel Casabianca
|
closable? |
@mattn , |
Close? |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Let's consider this code:
This produces following output:
Which means that:
map["spam"]
returns a value that is nil but doesn't passvalue == nil
._, ok = map["spam"]
works as expected, telling that map doesn't have key spam.I think that code
map["key"]
should throw an error instead than returning a weird nil value.The text was updated successfully, but these errors were encountered: