Minecraft /return command
Ends the running function early and gives a result value.
Syntax
/return <value>
/return run <command>
/return fail
Parts in square brackets are optional, parts in angle brackets are required. You do not type the brackets: Put your own value in their place.
Arguments
| Argument | What it does |
|---|---|
| <value> | The integer returned as the function's result. |
| fail | Ends the function as failed. |
Examples
/return 1
Ends the function with a result of 1.
/execute if entity @s[tag=ready] run return 1
Exits early when the condition is met.
Good to know
- Added in 1.20.2; it makes real branching in functions possible.
How do I run this command?
Press T in game to open chat (or press / directly), type the command and press Enter. While typing, Tab completes the options. This command counts as a cheat: It needs cheats enabled in a singleplayer world, and operator permission on a server (operator (level 2)).
Related commands
⚙️ More Advanced commands
Minecraft is a product of Mojang Studios. This tool is an independent helper made for players and is not affiliated with Mojang or Microsoft.