Skip to content

Functions

PandawanFr edited this page Aug 7, 2017 · 4 revisions

Introduction

Functions are a way to contain the code and commands which need to be put in a .mcfunction file. In short, they tell mcs what file to create and are required for mcs to compile correctly.

If you want to use JavaScript-like functions, check out Macros.

Declaring a Function

To declare a function, you use the function keyword, followed by the function's name and curly brackets ({ and }).

Example:

function myFunction {

};

You can add all your function and command logic inside the curly brackets ({ and }).

Calling a Function

Since function blocks simply compile into .mcfunction files, you can call them like you would in Minecraft.

Example:

function myNamespace:myFunction;
Clone this wiki locally