while loops
This commit is contained in:
13
README.md
13
README.md
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user