goto
Jump to a label within the current section. Used for retry
loops and conditional repetition.
goto does not cross subroutine boundaries — it can only jump within the section that contains
the matching label.
Properties
goto
Either a label name (shorthand) or an object that accepts the properties below. The shorthand
jumps to the label exactly as written, without variable expansion, with the default max of
100.
goto.label
Label to jump to. Must reference a label step earlier or later in the current section.
goto.max
Maximum number of jumps to label. Accepts an integer or a %{...} variable reference, such as
%{params.max_retries}; a reference is expanded and then converted to an integer. A reference
that doesn’t resolve allows no jumps — it does not fall back to 100.
Jumps are counted per target label for the whole run, not per goto step. Every goto that
targets the same label name shares one count, including goto steps in other sections and in
documents reached through execute or
transfer. Each jump attempt adds one to the count
and is allowed while the count is at most this step’s max.
When an attempt exceeds max, the jump doesn’t happen and the steps array that contains the
label ends without running its remaining steps. Execution continues with whatever ran that array,
such as the caller of an execute. A goto inside a switch case that targets a label in the
enclosing section ends that section; a label inside the same case array ends only the case, and
the steps after the switch still run.
max cannot raise the document’s limit of 100 steps, which counts every step including each
label passed. That limit can stop execution before max jumps are reached. If the limit is
reached on the goto step itself, the jump never happens and the run ends with a
swml_goto_label_not_found error.