diff --git a/eBook/01.2.md b/eBook/01.2.md index 588e88a47..857387247 100644 --- a/eBook/01.2.md +++ b/eBook/01.2.md @@ -116,7 +116,6 @@ Go 语言可以在 Intel 或 ARM 处理器上运行,因此它也可以在安 - 不支持动态链接库 - 不支持泛型 - 通过 `recover` 和 `panic` 来替代异常机制(第 13.2-3 节) -- 不支持断言 - 不支持静态变量 关于 Go 语言开发团队对于这些方面的讨论,你可以通过 [Go 常见问题](http://golang.org/doc/go_faq.html) 页面查看。 diff --git a/eBook/05.3.md b/eBook/05.3.md index f3c9d3f8b..a87846527 100644 --- a/eBook/05.3.md +++ b/eBook/05.3.md @@ -171,15 +171,26 @@ switch 语句还可以被用于 type-switch(详见第 11.4 节)来判断某 请说出下面代码片段输出的结果: ```go -k := 6 -switch k { - case 4: fmt.Println("was <= 4"); fallthrough; - case 5: fmt.Println("was <= 5"); fallthrough; - case 6: fmt.Println("was <= 6"); fallthrough; - case 7: fmt.Println("was <= 7"); fallthrough; - case 8: fmt.Println("was <= 8"); fallthrough; - default: fmt.Println("default case") -} + k := 6 + switch k { + case 4: + fmt.Println("was <= 4") + fallthrough + case 5: + fmt.Println("was <= 5") + fallthrough + case 6: + fmt.Println("was <= 6") + fallthrough + case 7: + fmt.Println("was <= 7") + fallthrough + case 8: + fmt.Println("was <= 8") + fallthrough + default: + fmt.Println("default case") + } ``` **练习 5.2:** [season.go](exercises/chapter_5/season.go): diff --git a/eBook/05.6.md b/eBook/05.6.md index 47f512637..f2175453b 100644 --- a/eBook/05.6.md +++ b/eBook/05.6.md @@ -87,7 +87,7 @@ for { //since there are no checks, this is an infinite loop if i >= 3 { break } //break out of this for loop when this condition is met fmt.Println("Value of i is:", i) - i++; + i++ } fmt.Println("A statement just after for loop.") ``` diff --git a/eBook/08.1.md b/eBook/08.1.md index 1571976a1..8a7f756e2 100644 --- a/eBook/08.1.md +++ b/eBook/08.1.md @@ -27,7 +27,7 @@ map 也可以用函数作为自己的值,这样就可以用来做分支结构 key1 对应的值可以通过赋值符号来设置为 val1:`map1[key1] = val1`。 -令 `v := map1[key1]` 可以将 key1 对应的值赋值为 v;如果 map 中没有 key1 存在,那么 v 将被赋值为 map1 的值类型的空值。 +令 `v := map1[key1]` 可以将 key1 对应的值赋值给 v;如果 map 中没有 key1 存在,那么 v 将被赋值为 map1 的值类型的空值。 常用的 `len(map1)` 方法可以获得 map 中的 pair 数目,这个数目是可以伸缩的,因为 map-pairs 在运行时可以动态添加和删除。