Comment on page
02 基本类型
Go支持你对静态语言所预期的所有基本数据类型:
类型称呼 | 类型(Type) | 字面量(Literal) |
布尔值 | bool | true, false |
整数 | int, int8, uint8, int16, uint16, int32, uint32, int64, uint64 | 38 |
浮点数 | float64, float32 (浮点数) | 23.5, 2e-12 |
字节 | byte (uint8, 1个char) | 'a' |
符文 | rune (int32, 1个Unicode字符) | 'p' |
字符串 | string | "foo", `bar` |
常量 | constants | const a = 8 |
结构体 | structs | type Foo struct {} |
切片 | slice (可变长向量) | []int = {1, -3, 4} |
数组 | array (固定长度向量) | [2]int = {2, -3} |
映射 | map (其他语言中称为字典dict或哈希表hash table) | map[string]int |
最近更新 3yr ago