This feature is exclusive to Java Edition.
The /return command is used in functions to change the return value and to skip subsequent commands in functions
Syntax
/return <value>
Output
- The
/execute store resultcan be used to store the return value of a function
Examples
execute store result score rueckgabe1 wiki run return 42 Basically not practical, but you can also access the return value directly and save it in a variable
execute store result score return2 wiki run function wiki:return If the command return 137 is in the wiki:rueckgabe function, the variable will receive this return value.
History
| Java Edition | |||||
|---|---|---|---|---|---|
| 1.20 | 23w16a | Added return. | |||