feat: for..in 范围语法 .. 改为 to 关键字

This commit is contained in:
2026-06-05 19:44:26 +08:00
parent 9a256d9be1
commit a28d33854c
8 changed files with 12 additions and 12 deletions
+3 -3
View File
@@ -188,13 +188,13 @@ while i < 5 {
### for 循环
```rust
for i in 0..5 {
for i in 0 to 5 {
print_i64(i);
}
// 输出: 0 1 2 3 4
```
`for i in start..end` 等价于 `let mut i = start; while i < end { ...; i += 1; }`
`for i in start to end` 等价于 `let mut i = start; while i < end { ...; i += 1; }`
### match
@@ -566,7 +566,7 @@ l_lang.exe source.l --emit-ir
类型: i64 f64 bool str void struct enum [T;N]
声明: let x = val let mut x = val
let x: Type = val type Alias = Type
控制流: if/else while for i in 0..N match
控制流: if/else while for i in 0 to N match
函数: fn name(p: T) -> Ret { return expr; }
结构体: struct Name { f: Type } Name { f: val }
枚举: enum Name { A, B, C } Name::B