Minecraft Wiki

The Minecraft Wiki has moved from Fandom; see the linked discussion page for details.

READ MORE

Minecraft Wiki
Advertisement
Information icon
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 result can 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.2023w16aAdded return.
Advertisement