Quick start
This page is a fast tour. Each section links to a deeper reference.
Variables
Section titled “Variables”int age = 25float rate = 1.5bool active = truestring name = "Pluvial"auto count = 10 # inferred as intauto title = "Rain" # inferred as stringThe initializer is required, and with an explicit type it must match exactly. auto
infers the type and then fixes it permanently — auto is not dynamic. See
Variables.
The base types are int, float, bool, string, and auto. Any base type can be made
nullable with ? (int?, string?). The compound types are array<T>, map<K,V>,
tuples like (int, string), user-defined structs and enums, and Result<T> /
Result<T, E>.
array<int> nums = [1, 2, 3]map<string, int> ages = {"alice": 30, "bob": 25}auto pair = (1, "hello") # a tupleThere are no implicit conversions — int + float is a compile error. See
Types.
Functions
Section titled “Functions”def add(int a, int b) int { return a + b}
def greet(string name) { # no return type → no value returned println("hi " + name)}Functions support default arguments and named arguments, and functions are first-class values: you can store lambdas in variables, pass them as arguments, and return them. See Functions.
Control flow
Section titled “Control flow”if (x > 0) { println("positive")} else { println("non-positive")}
for item in nums { println(item)}
while (count > 0) { count -= 1}
match status { 200 => { println("ok") } _ => { println("other") }}Conditions must be bool; braces are mandatory. See Control flow.
Error handling
Section titled “Error handling”Fallible operations return a Result<T>. You must narrow it with is ok / is err
before reading .value or .error:
Result<int> r = to_int("42")if (r is ok) { println(r.value) # 42} else { println(r.error)}See Error handling.
Structs
Section titled “Structs”struct Point { int x int y
def translate(int dx, int dy) Point { return Point { x: self.x + dx, y: self.y + dy } }}
Point p = Point { x: 1, y: 2 }Point q = p.translate(3, 4)Structs have value semantics — assignment copies. See Structs.
Modules
Section titled “Modules”import "math" # then math.add(1, 2)from "shapes" import Point, origin # bind names directlyimport std.math # standard-library shorthandSee Modules.
Standard library
Section titled “Standard library”Import modules under std/:
from std.io import read_filefrom std.http import getfrom std.time import nowSee the Standard library overview.