File tree Expand file tree Collapse file tree 2 files changed +9
-3
lines changed
Expand file tree Collapse file tree 2 files changed +9
-3
lines changed Original file line number Diff line number Diff line change @@ -39,7 +39,7 @@ type handle func (str string)
3939
4040```
4141
42- ###### Type aliases and type definitions (Distinction)
42+ ###### Type aliases and type definitions ** (Distinction)**
4343
4444Define built-in type definitions prior to Go 1.9:
4545```
Original file line number Diff line number Diff line change @@ -40,20 +40,26 @@ type handle func(str string)
4040
4141```
4242
43- ###### 类型别名和类型定义(区别)
43+ ###### 类型别名和类型定义** (区别)**
4444
4545在 Go 1.9 版本之前定义内建类型的定义:
46+ ```
4647type byte uint8
4748type rune int32
49+ ```
4850
4951而在 Go 1.9 版本之后变为:
52+ ```
5053type byte = uint8
5154type rune = int32
55+ ```
5256这个修改就是配合类型别名而进行的修改。
5357
5458定义类型别名的写法为:
59+ ```
5560type TypeAlias = Type
56- 类型别名规定:TypeAlias 只是 Type 的别名,本质上 TypeAlias 与 Type 是同一个类型
61+ ```
62+ 类型别名规定:TypeAlias 只是 Type 的别名,本质上 TypeAlias 与 Type 是同一个类型.
5763
5864```
5965package main
You can’t perform that action at this time.
0 commit comments