switch
Execute a sequence of instructions depending on which value matches a variable.
Parameters
Name | Type | Description |
---|---|---|
variable | string | Name of the variable whose value needs to be compared. Required. |
case | object | Object of values mapped to array of instructions to execute. Optional. Default is not set. |
default | array | Optional array of instructions to execute if no cases match. Optional. Default is not set. |
Variables
None
Examples
- YAML
- JSON
version: 1.0.0
sections:
main:
- switch:
variable: prompt_value
case:
1:
- goto: sales
2:
- play: "https://example.com/hello.wav"
default:
- play: "https://example.com/no_match.wav"
{
"version": "1.0.0",
"sections": {
"main": [
{
"switch": {
"variable": "prompt_value",
"case": {
"1": [{ "goto": "sales" }],
"2": [{ "play": "https://example.com/hello.wav" }]
},
"default": [{ "play": "https://example.com/no_match.wav" }]
}
}
]
}
}