mirror of
https://github.com/unknwon/the-way-to-go_ZH_CN.git
synced 2025-08-12 05:11:49 +08:00
modified: eBook/18.2.md
modified: eBook/18.3.md modified: eBook/18.4.md modified: eBook/directory.md
This commit is contained in:
@@ -1,6 +1,7 @@
|
|||||||
# 18.2 数组和切片
|
# 18.2 数组和切片
|
||||||
|
|
||||||
创建:
|
创建:
|
||||||
|
|
||||||
`arr1 := new([len]type)`
|
`arr1 := new([len]type)`
|
||||||
|
|
||||||
`slice1 := make([]type, len)`
|
`slice1 := make([]type, len)`
|
||||||
|
@@ -12,7 +12,7 @@ for key, value := range map1 {
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
(2)如何在一个映射中检测键key1是否存在:
|
(2)如何在一个映射中检测键`key1`是否存在:
|
||||||
|
|
||||||
`val1, isPresent = map1[key1]`
|
`val1, isPresent = map1[key1]`
|
||||||
|
|
||||||
|
@@ -10,7 +10,7 @@ type struct1 struct {
|
|||||||
ms := new(struct1)
|
ms := new(struct1)
|
||||||
```
|
```
|
||||||
|
|
||||||
初始化:
|
初始化:
|
||||||
```go
|
```go
|
||||||
ms := &struct1{10, 15.5, "Chris"}
|
ms := &struct1{10, 15.5, "Chris"}
|
||||||
```
|
```
|
||||||
|
@@ -151,17 +151,6 @@
|
|||||||
- 第16章:常见的陷阱与错误
|
- 第16章:常见的陷阱与错误
|
||||||
- 第17章:模式
|
- 第17章:模式
|
||||||
- 第18章:[出于性能考虑的实用代码片段](18.0.md)
|
- 第18章:[出于性能考虑的实用代码片段](18.0.md)
|
||||||
-18.1
|
|
||||||
-18.2
|
|
||||||
-18.3
|
|
||||||
-18.4
|
|
||||||
-18.5
|
|
||||||
-18.6
|
|
||||||
-18.7
|
|
||||||
-18.8
|
|
||||||
-18.9
|
|
||||||
-18.10
|
|
||||||
-18.11
|
|
||||||
- 第19章:构建一个完整的应用程序
|
- 第19章:构建一个完整的应用程序
|
||||||
- 第20章:Go 语言在 Google App Engine 的使用
|
- 第20章:Go 语言在 Google App Engine 的使用
|
||||||
- 第21章:实际部署案例
|
- 第21章:实际部署案例
|
||||||
|
Reference in New Issue
Block a user