Quick Start
Let’s write a RuneLang program from scratch. Create a file called hello.rune:
Hello, Adventurer
Section titled “Hello, Adventurer”Chant("Hail, adventurer! Welcome to RuneLang.");Run it:
runelang hello.runeOutput:
Hail, adventurer! Welcome to RuneLang.Chant is RuneLang’s print function. It outputs text to the console.
Variables
Section titled “Variables”// immutable by defaultRunestone name is "Gandalf";Countstone level is 20;Potion crit_chance is 0.15;Flagstone is_wizard is Truth;
Chant(name + " is level " + level);
// mutable variables require the Mutable keywordMutable Countstone health is 100;health is written as health - 25;Chant("Health: " + health);Your first Ritual
Section titled “Your first Ritual”Functions in RuneLang are called Rituals:
Ritual greet(Runestone hero_name) begins Chant("Welcome, " + hero_name + "! Your quest awaits.");end of Ritual
greet("Aragorn");greet("Legolas");Control flow
Section titled “Control flow”Mutable Countstone gold is 50;
// quest (if/else)Quest begins when (gold >= 100) Chant("You can afford the legendary sword!");elsewise when (gold >= 50) Chant("You can afford a decent shield.");elsewise Chant("You're broke. Go fight some goblins.");end of Quest
// odyssey (for loop)Odyssey for i from 1 to 4 is Chant("Round " + i + " - FIGHT!");end of Odyssey
// vigil (while loop)Mutable Countstone arrows is 3;Vigil whilst arrows > 0 is Chant("*fires arrow* (" + arrows + " left)"); arrows is written as arrows - 1;end of VigilCollections
Section titled “Collections”// scroll (array)Mutable Scroll inventory is ["Sword", "Shield", "Potion"];inventory.push("Bow");Chant("Inventory: " + inventory);Chant("First item: " + inventory[0]);
// tome (map / dictionary)Tome stats is {"str": 18, "dex": 14, "con": 16};Chant("Strength: " + stats["str"]);Error handling
Section titled “Error handling”Trap begins Countstone result is 10 / 0;Evade (err) Chant("Caught error: " + err);end of TrapWhat’s next?
Section titled “What’s next?”You’ve got the basics. Dive deeper:
- Variables & Types — the full type system
- Control Flow — quests, odysseys, vigils, and oracles
- Rituals & Spells — functions, lambdas, and closures
- Guilds & Realms — classes and enums