Return
Purpose: end a subroutine and go back to the step after the Call, optionally with a return value.

Return only appears in the Add Step list while you edit a subroutine. Value is the return value (expression allowed, optional).
JSON
json
{ "return": { "value": "${x} * 2" } }
{ "return": true }| Form | Meaning |
|---|---|
{"return": {"value": expression}} | Return a value |
{"return": true} or {"return": {}} | Just return, without a value |
A subroutine also returns by itself after its last step, but without a value.
Result
Return itself is PASS, and the Actual column shows returns value. If the Call has store but the subroutine returns without a value, the round stops and is judged FAIL (returned no value for ...).
Example
| Subroutine | What it does | Result |
|---|---|---|
double | Returns ${x} * 2 | double(21) = 42 |
clamp | Returns 100 early when x > 100, otherwise returns x | clamp(250) = 100 |

Notes
- A Return inside an If ends the subroutine early (
clampin the example). - A script with Return in a case does not load.
Download the sample script
Sample script
Before running it, start a Slave window on 127.0.0.1:502 and click Listen, then open the script with Open JSON in Script mode and click Run. See How to use the examples.
