map数据类型

This commit is contained in:
Deastern 2025-04-09 21:48:32 +08:00
parent ed6444c0ac
commit 087e1ba3a1

View File

@ -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)
} }