Skip to main content

goto

Jump to a label within the current section, optionally based on a condition. The goto method will only navigate to a label within the same section.

NameTypeDefaultDescription
gotoRequiredobject-An object that accepts the goto parameters.

goto Parameters

NameTypeDefaultDescription
labelRequiredstring-The label in section to jump to.
whenOptionalstringundefined (unconditional jump)JavaScript expression to evaluate.
maxOptionalinteger100The maximum number of times to jump, from the minimum of 1 to max 100 jumps.

Examples

Loop with max

version: 1.0.0
sections:
main:
- label: foo
- play:
url: 'say: This speech will be repeated 4 times.'
- goto:
label: foo
max: 3

Loop if a condition is satisfied

version: 1.0.0
sections:
main:
- label: foo
- play:
url: 'say: This is some text that will be repeated 4 times.'
- set:
do_loop: true
- goto:
label: foo
when: do_loop === true
max: 3