gobyexample/18-guard.go
Mark McGranaghan 0f5553f15d more
2012-09-16 12:54:15 -07:00

17 lines
256 B
Go

package main
import "fmt"
func main() {
x := make(map[string]string)
x["here"] = "yep"
if name, ok := x["not here"]; ok {
fmt.Println(name)
} else {
fmt.Println("missing")
}
if name, ok := x["here"]; ok {
fmt.Println(name)
}
}