Skip to content

Instantly share code, notes, and snippets.

@c9s
Created December 1, 2013 09:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save c9s/7730283 to your computer and use it in GitHub Desktop.
Save c9s/7730283 to your computer and use it in GitHub Desktop.
package main
import "fmt"
func main() {
contacts := map[string]string{}
contacts["John"] = "02-12345678"
contacts["Mary"] = "02-12345678"
if _, ok := contacts["Mary"]; ok {
fmt.Println("Mary is in the contacts")
}
if phoneNumber, _ := contacts["Mary"]; phoneNumber == "02-12345678" {
fmt.Println("correct phone number")
}
fmt.Printf("items %+v\n", contacts)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment