Statements
Statements control the flow of execution. Two rules hold across every kind:
- A condition is never parenthesised — write
if x > 0, notif (x > 0). - Every body is a block in braces, even when it contains a single statement.
A condition is always a bool; Rux does not treat numbers or pointers as truthy, so compare explicitly (if count != 0, not if count).
Conditionals
| Statement | Description |
|---|---|
if / else | Branch on Boolean conditions |
match | Exhaustive pattern matching |
Loops
| Statement | Description |
|---|---|
while | Loop while a condition holds |
for / in | Iterate over a collection or range |
loop | Unconditional infinite loop |
Loop Control
| Statement | Description |
|---|---|
break / continue | Alter loop control flow |