goto
Jump to a label
in a section, optionally depending on a condition.
Parameters
Name | Type | Requied? | Description | Description |
---|---|---|---|---|
label | string | Required | The label in section to jump to. | |
when | string | Optional | undefined (uncondional jump) | JavaScript expression to evaluate. |
max | integer | Optional | 100 | The maximum number of times to jump, from the minimum of 1 to max 100 jumps. |
Examples
Loop with max
- YAML
- JSON
version: 1.0.0
sections:
main:
- label: foo
- play: "say: This speech will be repeated 4 times."
- goto:
label: foo
max: 3
{
"version": "1.0.0",
"sections": {
"main": [
{
"label": "foo"
},
{
"play": "say: This speech will be repeated 4 times."
},
{
"goto": {
"label": "foo",
"max": 3
}
}
]
}
}
Loop if a condition is satisfied
- YAML
- JSON
version: 1.0.0
sections:
main:
- label: foo
- play: "say: This is some text that will be repeated 4 times."
- set:
do_loop: true
- goto:
label: foo
when: "do_loop === true"
max: 3
{
"version": "1.0.0",
"sections": {
"main": [
{
"label": "foo"
},
{
"play": "say: This is some text that will be repeated 4 times."
},
{
"set": {
"do_loop": true
}
},
{
"goto": {
"label": "foo",
"when": "do_loop === true",
"max": 3
}
}
]
}
}