gochang
Go语言中的常量使用关键字 const 定义,常量类型:布尔型、数字型(整数型、浮点型和复数)和字符串
1、const name [type] = value (类型说明符 [type]可以省略)
2、使用 const 常量的 iota 来模拟枚举类型
3、%d、%s、%b 、%T (十进制、字符型、二进制、类型别名)
4、类型别名
- // 将int取一个别名叫IntAlias
- type IntAlias = int
5、保留关键字
| break | default | func | interface | select |
| case | defer | go | map | struct |
| chan | else | goto | package | switch |
| const | fallthrough | if | range | type |
| continue | for | import | return | var |
6、特殊的标识符
| append | bool | byte | cap | close | complex | complex64 | complex128 | uint16 |
| copy | false | float32 | float64 | imag | int | int8 | int16 | uint32 |
| int32 | int64 | iota | len | make | new | nil | panic | uint64 |
| println | real | recover | string | true | uint | uint8 | uintptr |
posted on 2020-01-07 11:56 HelloOcean 阅读(190) 评论(0) 收藏 举报
浙公网安备 33010602011771号