package main
import "fmt"
func main() {
var count map[string]string
count = make(map[string]string)
count["first"] = "first"
for s := range count {
fmt.Println(s)
}
}
結(jié)果
first
聲明變量 用map[鍵數(shù)據(jù)類型]值數(shù)據(jù)類型
make 是作map的初始化徙赢,不然是nil鸡挠,無法進(jìn)行鍵值對(duì)輸入