Minecraft Wiki

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

READ MORE

Minecraft Wiki
Advertisement
Gear (item)
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.
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.
1.20.223w31aAdded a new subcommand run to return.
Advertisement