Language
31 chapters.
- Assignmentconst by default, var only when you must mutate.
- ArraysFixed-length sequences whose length is part of the type.
- If ExpressionsNo truthiness: if takes a bool.
- While LoopsConditions, continue expressions, and loops that produce values.
- For LoopsIterate over sequences and ranges, never a bare counter.
- FunctionsImmutable parameters and explicit discards.
- DeferCleanup that runs on every path out of a scope.
- ErrorsErrors are values in a union, not exceptions.
- SwitchExhaustive by construction.
- Runtime SafetyChecked illegal behaviour, and where the checks go.
- PointersSingle-item pointers that are never null.
- Pointer Sized Integersusize, isize, and why they are not just u64.
- Many-item Pointers[*]T: a pointer to an unknown number of items.
- SlicesA pointer and a length, together.
- EnumsNamed values, fixed tags, and methods.
- StructsLayout, defaults, and methods.
- UnionsOne of several types, sharing one allocation.
- Integer RulesArbitrary widths, explicit narrowing, chosen overflow behaviour.
- FloatsIEEE-754 types and explicit conversions.
- Labelled BlocksBlocks that produce a value.
- Labelled LoopsBreak or continue an outer loop by name.
- Loops as Expressionselse supplies the value when nothing breaks.
- Payload CapturesThe |value| syntax that unwraps everything.
- OptionalsZig's answer to null, checked by the compiler.
- ComptimeOrdinary Zig, executed by the compiler.
- Inline LoopsUnrolled loops where each iteration can differ in type.
- OpaqueTypes with unknown size, used through pointers only.
- Anonymous StructsInferred struct literals, and tuples.
- Sentinel TerminationSequences that end in a known marker.
- VectorsSIMD with ordinary operators.
- ImportsFiles are structs, and pub controls the boundary.