Ai
61 Star 659 Fork 311

ShirDon-廖显东/Go Web编程实战派源码

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
1.4-map.go 1.21 KB
一键复制 编辑 原始数据 按行查看 历史
ShirDon-廖显东 提交于 2024-10-28 00:54 +08:00 . update
// ++++++++++++++++++++++++++++++++++++++++
// 《Go Web编程实战派从入门到精通》源码
// ++++++++++++++++++++++++++++++++++++++++
// Author:廖显东(ShirDon)
// Blog:https://www.shirdon.com/
// 仓库地址:https://gitee.com/shirdonl/goWebActualCombat
// 仓库地址:https://github.com/shirdonl/goWebActualCombat
// ++++++++++++++++++++++++++++++++++++++++
package main
import "fmt"
func main() {
var literalMap map[string]string
var assignedMap map[string]string
literalMap = map[string]string{"first": "go", "second": "web"}
createdMap := make(map[string]float32)
assignedMap = literalMap
createdMap["k1"] = 99
createdMap["k2"] = 199
assignedMap["second"] = "program"
fmt.Printf("Map literal at \"first\" is: %s\n", literalMap["first"])
fmt.Printf("Map created at \"k2\" is: %f\n", createdMap["k2"])
fmt.Printf("Map assigned at \"second\" is: %s\n", literalMap["second"])
fmt.Printf("Map literal at \"third\" is: %s\n", literalMap["third"])
//achievement := map[string]float32{
// "zhangsan": 99.5, "lisi": 88,
// "wangwu": 96, "lidong": 100,
//}
//createdMap := new(map[string]float32)
//createdMap["k1"] = 4.5
//
//fmt.Println(createdMap)
//map2 := make(map[string]float32, 100)
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Go
1
https://gitee.com/shirdonl/goWebActualCombat.git
git@gitee.com:shirdonl/goWebActualCombat.git
shirdonl
goWebActualCombat
Go Web编程实战派源码
1675db770ff5

搜索帮助