while loops

This commit is contained in:
uan
2026-02-07 15:48:59 +01:00
parent 58f0dfa969
commit 9d26256023
5 changed files with 47 additions and 7 deletions

View File

@@ -211,7 +211,8 @@ User {
### Control Flow
Control flow in One is still quite limited, as the `for` keyword has not been implemented yet. `if`, `else` and `elif` statements are fully implemented and are written like this.
Control flow in One isn't fully implemented yet, but it is already functional.
`if`, `else` and `elif` statements are fully implemented and are written like this:
```
let x int = 17;
@@ -225,7 +226,15 @@ if x >= 100 {
}
```
Using parentheses around the condition isn't necessary.
`while` loops are very similar, and can be written like this:
```
let i int = 0;
while i < 10 {
print(i);
i++;
}
```
### The main function