docs: 自定义类型、类型别名

This commit is contained in:
Shikong 2021-09-24 01:27:31 +08:00
parent e142f1f224
commit 78decca578

View File

@ -5,6 +5,14 @@ import (
"strconv" "strconv"
) )
// 自定义 新类型
// 自定义类型 编译后 依然存在
type myInt int
// 类型别名
// 类型别名 编译后 定义的 类型别名将不存在 变为 别名对应的类型 只存在于代码中
type aliasInt = int
func f1() { func f1() {
fmt.Println("exec f1()") fmt.Println("exec f1()")
} }