diff --git a/chapters/maps/presence/index.md b/chapters/maps/presence/index.md index d0ec275..7b34ea2 100644 --- a/chapters/maps/presence/index.md +++ b/chapters/maps/presence/index.md @@ -2,5 +2,10 @@ title: Testing for the Presence of a Key in a Map question: How do I determine if a map contains a given key? --- - -http://stackoverflow.com/questions/2050391/how-to-check-if-a-map-contains-a-key-in-go +``` + if val, ok := dict["foo"]; ok { + //key found - do somehting + } else { + //Key does not exist + } +```