Loop expressions
"Loop" expressions
The most flexible type of loop is loop.
Like with if, the body goes in an indented block.
The body should be an expression ending in
break or continue.
Loops as expressions
The above example shows a void loop.
Loops can have any type. The value of the loop is the value passed to break.
(This value defaults to () if not written explicitly.)
This avoids using an unnecessarily mutable variable for the loop result.
"While" expressions
while is as a shorthand for a loop that
breaks if the condition is false,
else runs the body and continues.
So the first example could be rewritten as:
"Until" expressions
until is the same as while,
but the condition is negated.
Tail recursion
When a function ends by calling itself, crow replaces the function body with a loop for efficiency.
If you use tail recursion, you don't technically need loop, and vice versa.
Choose whichever option suits your style.