XU XUv0.8.8
中文

Docs / Tutorial

02 · Bindings and constants

Immutable by default. Write mut to reassign. const is a compile-time constant. No mutable globals.

Source

@main

const max = 100

fn main() int {
    name := "Xu"
    mut age := 20
    age += 1

    println(name)
    println(age)
    println(max)
    << 0
}

Build (from the language repo root; swap the binary for your platform):

xu run examples/02_bindings/main.xu
# or: xu build examples/02_bindings/main.xu
# default artifact is ./main on mac/linux, ./main.exe on Windows

Run from the separate examples repository root; source files live under examples/.