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
| Mode | Description |
|---|---|
random | Select a random element each time. (default) |
one | Select the same, random element each time. |
forward | Select in a wrapping sequence from first to last. |
forward-clamp | Select from first to last, then repeat the last element forever. |
forward-mirror | Select from first to last, then last to first, then start over. |
reverse | Select in a wrapping reverse sequence from last to first. |
reverse-clamp | Select from last to first, then repeat the first element forever. |
reverse-mirror | Select in a from last to first, then first to last, then start over. |
deck | Select each element once in a random sequence, then reshuffles. |
deck-loop | Select each element once in a wrapping random sequence, without reshuffling. |
deck-clamp | Select each element once in a random sequence, repeating the final element. |
deck-mirror | Select each element once in a random sequence, then repeats the sequence backwards before reshuffling. |
ping | Select from first to last, switching directions when a boundary element is reached. |
pong | Select from last to first, switching directions when a boundary element is reached. |
no-double | Select a random element each time, ensuring the same element never occurs twice in a row. |
match | Select 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.