Calling a Function - LucFr1746/Minecraft-Coding GitHub Wiki

Calling a function is like using an effect. But if the function has the ability to return something, can also be used like an expression.

functionName(parameters)

  • Parameters can be replicated using commas or "and".
    • The type can be plural (eg. number -> numbers, entity -> entities) to allow multiple values in one parameter.
  • To enter a raw list for a parameter, it must be in parentheses. Otherwise, it might conflict with other function parameters as both use commas and "and". This is not needed if the function has only one parameter.

Example:

functionName(parameter1, (value1, value2 and value3), parameter3)

Of course, if the list comes from a variable or an expression this is not needed. For example {list::*} or all players can be entered for the parameter directly.

  • Calling a function inside of another function is possible. It is also possible to call the function from inside of itself (this is called recursion)!