Control Flow

Conditionals, every kind of loop, and functions.

Conditionals

if, elif, and else work exactly as you would expect, with braces for the blocks.

rune
9 lines

while loops

Loop while a condition holds. Combined with a counter and the increment operator, this is the classic countdown engine.

rune
5 lines

for loops

Three flavours: a classic counter, iterating a list or dict, and counting over a range.

rune
18 lines

break, continue, and stop

break and continue work inside loops. stop halts the whole tag immediately. Anything already sent with say is still delivered, and everything after is skipped.

rune
5 lines
rune
7 lines

A switch is also available for dispatching on a value when a chain of elifs starts to drag.

Functions

Named and anonymous. A function body always uses braces. Define once, call anywhere.

rune
4 lines

Functions are first-class, so you can hand them to the list builtins for a quick map, filter, or reduce.

rune
3 lines

The full set of list combinators lives in the Builtins chapter.