-
Couldn't load subscription status.
- Fork 85
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
letand named using camelCase:
let sandStack = Item.of("minecraft:sand", 64);- Constants should be initialized using
constand 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 theclasskeyword, 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");All content in this wiki is licensed under the Creative Commons Attribution-Non-Commercial-ShareAlike 4.0 License unless otherwise stated.
This license does NOT extend to code and content within the Create: Astral Space Reborn modpack, which is All Rights Reserved to the respective copyright holders of the contributed code or content.