return
Return from execute
or exit script.
Name | Type | Default | Description |
---|---|---|---|
return Required | any | - | The return value. |
return Parameters
No specific parameters. The value can be set to any
type.
Variables
Set by the method:
- return_value:(out) Optional return value.
Examples
Return with optional value
- YAML
- JSON
version: 1.0.0
sections:
main:
- return: 1
{
"version": "1.0.0",
"sections": {
"main": [
{
"return": 1
}
]
}
}
Return with multiple values
- YAML
- JSON
version: 1.0.0
sections:
main:
- execute:
dest: fn_that_returns
- play:
url: 'say: returned %{return_value[0].a}'
fn_that_returns:
- return:
- a: 1
- b: 2
{
"version": "1.0.0",
"sections": {
"main": [
{
"execute": {
"dest": "fn_that_returns"
}
},
{
"play": {
"url": "say: returned %{return_value[0].a}"
}
}
],
"fn_that_returns": [
{
"return": [
{
"a": 1
},
{
"b": 2
}
]
}
]
}
}
using the on_return
parameter
- YAML
- JSON
version: 1.0.0
sections:
main:
- execute:
dest: fn_that_returns
on_return:
- play:
url: 'say: returned %{return_value}'
fn_that_returns:
- return: hello
{
"version": "1.0.0",
"sections": {
"main": [
{
"execute": {
"dest": "fn_that_returns",
"on_return": [
{
"play": {
"url": "say: returned %{return_value}"
}
}
]
}
}
],
"fn_that_returns": [
{
"return": "hello"
}
]
}
}
Return with no value
- YAML
- JSON
version: 1.0.0
sections:
main:
- return: {}
{
"version": "1.0.0",
"sections": {
"main": [
{
"return": {}
}
]
}
}
Additional examples are available in the introduction.