Loops
In Umbra, for is the only looping construct, offering two distinct forms: the initialized for statement and the conditional for statement.
Initialized
The initialized for loop has an initializer, stop condition, and an optional step value, structured as
i starts at 0, runs until 10, and increments by 2 on each iteration, resulting in
Conditional
The conditional for loop, on the other hand, is structured with a condition, executing as long as the condition remains true.
If no condition is specified, the loop becomes infinite, running until explicitly broken with break.
Control loop flow
Umbra also includes break and continue statements to control loop flow. break immediately exits the loop, while continue skips to the next iteration, allowing precise control over looping behavior.
results in
Next example: Conditions