gobyexample/src/17-maps.go
Mark McGranaghan c8099a29d7 src dir
2012-09-17 17:25:00 -07:00

19 lines
301 B
Go

package main
import "fmt"
func main() {
x := make(map[string]int)
x["this"] = 7
x["that"] = 13
fmt.Println(x)
fmt.Println(x["this"])
fmt.Println(x["missing"])
fmt.Println(len(x))
delete(x, "that")
fmt.Println(x["that"])
fmt.Println(len(x))
_, present := x["that"]
fmt.Println(present)
}