Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Standard Library: Attributes & Control Flow

if

[if: condition]

Marks the next block as conditional and resolves it only when condition is truthy.

elseif

[elseif: condition]

Marks the next block as an else if branch following a previous conditional block.

else

[else]

Marks the next block as the fallback branch after a previous conditional block.

mksel

[mksel: selector-mode; match-value?]

Creates and returns a selector with the specified mode. match mode requires a match value; all other modes reject one.

Options for selector-mode

ModeDescription
randomSelect a random element each time. (default)
oneSelect the same, random element each time.
forwardSelect in a wrapping sequence from first to last.
forward-clampSelect from first to last, then repeat the last element forever.
forward-mirrorSelect from first to last, then last to first, then start over.
reverseSelect in a wrapping reverse sequence from last to first.
reverse-clampSelect from last to first, then repeat the first element forever.
reverse-mirrorSelect in a from last to first, then first to last, then start over.
deckSelect each element once in a random sequence, then reshuffles.
deck-loopSelect each element once in a wrapping random sequence, without reshuffling.
deck-clampSelect each element once in a random sequence, repeating the final element.
deck-mirrorSelect each element once in a random sequence, then repeats the sequence backwards before reshuffling.
pingSelect from first to last, switching directions when a boundary element is reached.
pongSelect from last to first, switching directions when a boundary element is reached.
no-doubleSelect a random element each time, ensuring the same element never occurs twice in a row.
matchSelect from elements whose @on trigger equals the selector's stored value; otherwise, use untagged fallback elements. Cursor operations are unsupported.

rep

[rep: reps]

Sets the repetition count or repetition mode for the next block.

sel

[sel: selector?]

Sets the active selector for the next block. With no argument, prints the current selector or nothing.

match

[match: value]

Sets the active selector for the next block to a match selector bound to value.

sep

[sep: separator]

Sets the separator value for repeated block iterations.

mut

[mut: mutator?]

Sets the mutator function for the next block, or clears it when passed nothing.

sel-skip

[sel-skip: selector; n?]

Advances selector without printing any selected value. This is unsupported for match selectors.

sel-freeze

[sel-freeze: selector; frozen?]

Sets the frozen state of selector. Omitting frozen freezes it. This is unsupported for match selectors.

sel-frozen

[sel-frozen: selector]

Prints whether selector is currently frozen. This is unsupported for match selectors.

reset-attrs

[reset-attrs]

Resets the current attribute state back to the runtime defaults.

step

[step]

Prints the current repeater step value using a 1-based index.

step-index

[step-index]

Prints the zero-based iteration index of the active repeater.

step-count

[step-count]

Prints the total number of iterations scheduled for the active repeater. Infinite repeaters report 0.