This section provides a comprehensive reference for the Zith programming language, aligned with the language specification (docs/Zith-spec.md).
Fundamental syntax: comments, identifiers, literals, expressions, and statements.
Organising code with import, from, export, alias, use, and visibility modifiers (pub, mod).
Primitives, slices, arrays, enums, structs, components, unions, packs, generics, and pattern matching with when.
Variable declaration with let, var, global, const, comptime, deep mutability, and destructuring.
Function kinds (fn, const fn, async fn, flow fn, raw fn), return types, implicit returns, closures, and the @ prefix rule.
Conditionals, loops (for), pattern matching (when), chain flow (->), and flow functions with markers.
Node Resource Analysis: ownership keywords (lend, view, unique, share, belong), move semantics, and the four NRA rules.
Allocation strategies, scenes as memory regions, custom allocators, and runtime memory patterns.
Failable types (?T, T!), propagation (?, !), fallback (or), with/catch, fail blocks, and throw.
Explicit and implicit generic parameters, type constraints with or, and monomorphisation.
For more advanced features, see the Advanced Topics section:
| Topic | Example |
|---|---|
| Variables | let x: i32 = 5; |
| Functions | fn add(a: i32, b: i32): i32 { a + b } |
| Ownership | lend, view, unique, share, belong |
| Control Flow | if, for, when, -> |
| Error Handling | ?T, T!, ?, !, or |
| Modules | import path as name, from path, pub, mod |
See also: Spec: Overview & Design Philosophy
Ready to learn? Start with Syntax Basics →