Commands/function

Runs a function or all functions in a tag from a datapack. Runs a function from a behavior pack.


 * Syntax




 * Arguments


 * function


 * Java Edition
 * May be of the format, or.
 * The format without the  prefix, , runs a single function located at.
 * The format with the  prefix, , runs all functions included in the function tag located at.


 * Bedrock Edition
 * May be of the format
 * Runs the function located at


 * Result


 * Fails if the argument is not specified correctly.


 * If successful, runs a function through the command source which ran the command.


 * Java Edition
 * If is ran inside of another function, it always fails but still executes its command entries;
 * Otherwise, returns the number of commands ran (not the number of commands that succeed) plus the number of embedded functions called by this function.


 * Examples


 * Java Edition
 * To run a function located at  in a loaded data pack:
 * To run all functions in a function tag located at :
 * To run a function if there is a sheep within a radius of 2 blocks:
 * To run a function unless the executor is a player: