Created
December 6, 2011 17:21
-
-
Save jswank/1439033 to your computer and use it in GitHub Desktop.
Check for existence of key in map
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
package main | |
import "fmt" | |
func main() { | |
m := make(map[string]string) | |
if m["foo"] == "" { | |
fmt.Println("No such key in map"); | |
} | |
fmt.Printf("%s", m) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment