Skip to content

Commit 5ca0d83

Browse files
author
刘建秋
committed
type alias
1 parent d7d57c8 commit 5ca0d83

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

EN/type.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff 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

4444
Define built-in type definitions prior to Go 1.9:
4545
```

zh_CN/type.md

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,20 +40,26 @@ type handle func(str string)
4040
4141
```
4242

43-
###### 类型别名和类型定义(区别)
43+
###### 类型别名和类型定义**(区别)**
4444

4545
在 Go 1.9 版本之前定义内建类型的定义:
46+
```
4647
type byte uint8
4748
type rune int32
49+
```
4850

4951
而在 Go 1.9 版本之后变为:
52+
```
5053
type byte = uint8
5154
type rune = int32
55+
```
5256
这个修改就是配合类型别名而进行的修改。
5357

5458
定义类型别名的写法为:
59+
```
5560
type TypeAlias = Type
56-
类型别名规定:TypeAlias 只是 Type 的别名,本质上 TypeAlias 与 Type 是同一个类型
61+
```
62+
类型别名规定:TypeAlias 只是 Type 的别名,本质上 TypeAlias 与 Type 是同一个类型.
5763

5864
```
5965
package main

0 commit comments

Comments
 (0)