Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/ToberlerOhn/hades/llms.txt

Use this file to discover all available pages before exploring further.

Every variable in Hades carries an explicit type annotation written directly into its declaration. This static-style discipline means the interpreter can catch type mismatches at runtime before they silently corrupt your data — there are no implicit coercions between unrelated types.

Declaration syntax

The general form of a variable declaration is:
name: type = value;
The name comes first, followed by a colon, then the type keyword, then an assignment and an initial value. The one exception to mandatory initialisation is the nothing type — a nothing variable may be declared without a value because nothing is the value.
foo: nothing;          // valid — no initializer needed
bar: bool = FALSE;     // boolean
baz: int  = 42;        // integer
qux: float = 3.14;     // floating-point
msg: str  = 'hello';   // string
Semicolons are required after most statements. The two exceptions are: immediately after a closing }, and at the very end of a block just before its own }.

Built-in types

The following type keywords are recognised by the interpreter for variable declarations and type hints:

nothing

Represents the absence of a value. All nothing variables are falsy. The only type that does not require an initializer.

bool

Boolean logic. Literal values are TRUE and FALSE (uppercase). Any non-FALSE boolean is truthy.

int

Whole numbers: 0, 1234, -7. Zero is falsy; any other integer is truthy.

float

Floating-point numbers: 1234.5678. Zero (0.0) is falsy; all other floats are truthy.

str

Single-quoted strings: 'hello'. An empty string '' is falsy; non-empty strings are truthy.

list

Mutable, ordered sequences of any values enclosed in [ ]. An empty list is falsy.
The Hades language specification also describes a record immutable sequence type (written as "elem0, elem1" and accessed with variable"index") and a struct type. These types are part of the planned language grammar but are not yet executed by the current interpreter. Declaring a variable with a record or struct type hint will produce a parse or runtime error in the current release.

Truthiness reference

Hades uses truthiness rules to evaluate non-boolean values in conditions such as if guards and while tests.
TypeTruthyFalsy
nothingalways
boolTRUEFALSE
intany non-zero value0
floatany non-zero value0.0
strany non-empty string''
listany non-empty list[]

Type checking

The interpreter enforces the declared type at the point of assignment. Declaring a variable with one type and providing a value of another raises a runtime InterpreterError:
count: int = 3.14;   // Error — expected int, got float
flag: bool = 1;      // Error — expected bool, got int
The same check applies to function parameters and return values, so every variable in scope can be trusted to hold exactly the type it was declared with.

Complete example

// Primitive declarations
name: str   = 'Alice';
age:  int   = 20;
gpa:  float = 3.712;
active: bool = TRUE;

// nothing needs no initializer
placeholder: nothing;

// List type
scores: list = [95, 87, 92, 78];

// Use type() to inspect a value at runtime
print(type(age));     // int
print(type(scores));  // list
Use the built-in type(value) function to inspect a variable’s type at runtime. It returns the type name as a string, which is especially helpful when debugging dynamic list contents.

Build docs developers (and LLMs) love