Logo

Programming-Idioms

History of Idiom 51 > diff from v24 to v25

Edit summary for version 25 by programming-idioms.org:
[Go] +DemoURL

Version 24

2016-06-13, 09:40:55

Version 25

2016-08-03, 16:09:32

Idiom #51 Check if map contains key

Determine whether map m contains an entry for key k

Idiom #51 Check if map contains key

Determine whether map m contains an entry for key k

Extra Keywords
table dictionary hash
Extra Keywords
table dictionary hash
Code
_, ok := m[k]
Code
_, ok := m[k]
Comments bubble
ok is true if m contains a value for key k. The value itself is ignored.
Comments bubble
ok is true if m contains a value for key k. The value itself is ignored.
Demo URL
https://play.golang.org/p/vU-X4k3YQJ