feat: 新增 i32 / u64 / char 类型 + 字符字面量 "'a'"
This commit is contained in:
@@ -81,9 +81,12 @@ graph TB
|
||||
|
||||
| 类型 | 语法 | 示例 |
|
||||
|------|------|------|
|
||||
| 32 位有符号整数 | `i32` | `100` |
|
||||
| 64 位有符号整数 | `i64` | `42`, `-7` |
|
||||
| 64 位无符号整数 | `u64` | `999` |
|
||||
| 64 位浮点数 | `f64` | `3.14` |
|
||||
| 布尔值 | `bool` | `true`, `false` |
|
||||
| 字符 | `char` | `'A'` |
|
||||
| 字符串 | `str` | `"hello"` |
|
||||
| 结构体 | `struct` | `Point { x: i64, y: i64 }` |
|
||||
| 枚举 | `enum` | `Color { Red, Green, Blue }` |
|
||||
@@ -92,7 +95,7 @@ graph TB
|
||||
| 类型别名 | `type` | `type Meters = i64;` |
|
||||
|
||||
- `let` 不可变 + `var` 可变,类型推断
|
||||
- `i64` → `f64` 自动提升
|
||||
- `i32` → `i64` → `f64` 自动加宽,`char` 可隐式转为整数
|
||||
|
||||
### 控制流
|
||||
|
||||
|
||||
Reference in New Issue
Block a user