Improved docs (allman syntax)

This commit is contained in:
2026-07-03 22:21:33 +02:00
parent ddf3efdf6e
commit 581390933d
8 changed files with 57 additions and 38 deletions
+18 -10
View File
@@ -7,17 +7,20 @@ icon: ArrowLeftRight
### If/Else
```mist
if condition {
if condition
{
// body
} else if other_condition {
}
else if other_condition
{
// body
} else {
}
else
{
// body
}
```
Conditions must be parenthesized: `if (expr) { }` or `if expr_no_struct { }` (struct literals require parentheses).
Used as an expression:
```mist
@@ -27,7 +30,8 @@ let x = if true { 1 } else { 2 };
### While
```mist
while condition {
while condition
{
// body
}
```
@@ -35,11 +39,13 @@ while condition {
### For
```mist
for pattern in iterator {
for pattern in iterator
{
// body
}
for i in 0 .. 10 {
for i in 0 .. 10
{
// body
}
```
@@ -47,7 +53,8 @@ for i in 0 .. 10 {
### C-Style For
```mist
for (let mut i = 0; i < 10; i++) {
for (let mut i = 0; i < 10; i++)
{
// body
}
```
@@ -55,7 +62,8 @@ for (let mut i = 0; i < 10; i++) {
### Loop
```mist
loop {
loop
{
// infinite loop
}
```