This article is a work in progress.
Please help in the expansion or creation of this article by expanding or improving it. The talk page may contain suggestions.
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 return1 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:return function, the variable will receive this return value.
History
| Java Edition | |||||
|---|---|---|---|---|---|
| 1.20 | 23w16a | Added return. | |||
| 1.20.2 | 23w31a | Added run subcommand to return. | |||