Wiki 9Minecraft Wiki 9Minecraft
Minecraft Legends › BSharpReferenceSheet › Helper functions

Helper functions

Minecraft Legends

BSharpReferenceSheet
Official docs

Helper functions (local to a file or global to all) are ways to execute common functionality repeatedly. If you notice yourself duplicating scripts or doing something very similar make a helper function or reach out to fellow scripters for assistance!

In B# land we define functions like so:

// or MyLocalFunction if you wanted it to be global!
const _myLocalFunction = (argument1, argument2) => {
   // do stuff!
}

If you have used Javascript before then you may be more familiar with this syntax:

``function _myLocalFunction(argument1, argument2) => { }``

We don’t do this because you can redefine and *stomp* an existing function - which leads to really hard to catch bugs!