Skip to content

Language Overview

Zap is designed around a simple principle: say what you mean, and nothing more. The language favours explicit over implicit, clarity over cleverness, and composition over inheritance.

  • Strong static typing with type inference — you rarely need to write types explicitly, but they’re always known at compile time.
  • First-class functions — functions are values, can be stored in variables, passed as arguments, and returned from other functions.
  • Pattern matching — destructure values and branch on their shape in a single, readable expression.
  • Immutable by default — bindings are immutable unless explicitly declared mutable with mut.
  • No null — Zap uses an Option type to represent the absence of a value.
  • Module system — organise code into modules, import what you need, and keep your namespaces clean.
Concept Zap Syntax
Variable let x = 42
Mutable var let mut x = 42
Function fn add(a: Int, b: Int) -> Int { a + b }
If / else if cond { ... } else { ... }
Loop for item in list { ... }
Match match value { Pattern => expr, ... }
Module import import std.io
  • Syntax Basics — variables, expressions, statements
  • Types — primitives, composites, generics
  • Functions — declarations, closures, higher-order
  • Control Flow — if/else, loops, match
  • Modules — imports, exports, project structure