XU XUv0.16.0

02 · Bindings and constants

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

Source

@main

const MAX = 100

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

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

Build:

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/.