Skip to content

Naming variables

The-Shortman edited this page Sep 27, 2025 · 1 revision

This document explains how to name variables depending on what they're defining.


  • Names should describe what the purpose of the variable is.
// Do this
items.forEach((item) => {
  //...
});

// Don't do this
items.forEach((e) => {
  //...
});
  • Variables should be initialized using let and named using camelCase:
let sandStack = Item.of("minecraft:sand", 64);
  • Constants should be initialized using const and named using either camelCase or SCREAMING_SNAKE_CASE:
const incompleteTransitionalCircuit = "createastral:incomplete_transitional_electronic_circuit";
const BUCKET = 81000;
  • Functions should be named using camelCase:
function itemCount(itemName, count) {
  // ...
}
  • Classes should be named using PascalCase.
    KubeJS does not support the class keyword, so you must use constructor functions instead.
function SequencedAssemblyBuilder(event, io) {
  this._event = event;
  // ...
}
  • Java classes should be prepended with a $ sign.
const $DeferredRegister = java("dev.architectury.registry.registries.DeferredRegister");
Clone this wiki locally