map数据类型
This commit is contained in:
parent
ed6444c0ac
commit
087e1ba3a1
@ -19,4 +19,12 @@ func main() {
|
|||||||
fmt.Printf("integer: %d, float: %f, boolean: %t, string: %s\n",
|
fmt.Printf("integer: %d, float: %f, boolean: %t, string: %s\n",
|
||||||
integer, float, boolean, str)
|
integer, float, boolean, str)
|
||||||
fmt.Printf("array: %v, slice: %v\n", array, slice)
|
fmt.Printf("array: %v, slice: %v\n", array, slice)
|
||||||
|
|
||||||
|
var mapExample map[string]int = map[string]int{
|
||||||
|
"one": 1,
|
||||||
|
"two": 2,
|
||||||
|
}
|
||||||
|
|
||||||
|
exo := mapExample["one"]
|
||||||
|
fmt.Printf("mapExample: %v, mapExample[\"one\"]: %d\n", mapExample, exo)
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user