Signed-off-by: Tinywan <756684177@qq.com>
pull/8/head
Tinywan 6 years ago
parent 4c0a36e59a
commit 54ad9f0454

@ -73,13 +73,8 @@ $ go get github.com/Tinywan/golang-tutorial
### 34 - 反射
### 35 - 读文件
## 官方文档
## 其他文档
* [如何编写Go代码](/docs/how_to_write_go_code.md)
###### HELP
* [原文](https://golangbot.com/)
* [译者一](http://blog.csdn.net/u011304970/article/details/74797939)
* [译者二](https://www.studygolang.com/gctt/Noluye)
本文由 [GCTT](https://github.com/studygolang/GCTT) 原创翻译,[Go语言中文网](https://studygolang.com/)首发。

@ -1,15 +1,24 @@
package main
import (
"time"
"fmt"
)
func main(){
func main() {
// map[KeyType]ValueType 集合类型
var personSalary map[string]int
var personSalary map[string]int
// go的三个引用类型 map slice chan
if personSalary == nil {
fmt.Println("map is nil. Going to make one.")
personSalary = make(map[string]int)
fmt.Printf(format string, a ...interface{})
time.Microsecond
fmt.Printf(format string, a ...interface{})
fmt.Print(a ...interface{})
time.Millisecond();
fmt.Print(a)
fmt.Println(a)
fmt.Printf(format, a)
}
}
}

@ -33,6 +33,7 @@ func main(){
}else{
fmt.Println(newEmp,"not found")
}
fmt.Println("----------------遍历 map 中所有的元素---------------------")
for key,value := range personSalary {
fmt.Printf("personSalary[%s] = %d \n",key,value)

Loading…
Cancel
Save