Statements

Statements control the flow of execution. Two rules hold across every kind:

  • A condition is never parenthesised — write if x > 0, not if (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

StatementDescription
if / elseBranch on Boolean conditions
matchExhaustive pattern matching

Loops

StatementDescription
whileLoop while a condition holds
for / inIterate over a collection or range
loopUnconditional infinite loop

Loop Control

StatementDescription
break / continueAlter loop control flow