Skip to content

Take Milo for a walk ​

Each program's output below is captured from a native build. To edit and run them yourself, install Milo.

Immutable by default

A let binding is immutable; a var is mutable. You opt in to change.

values.milo
milo
fn main(): i32 {
    let name = "Milo"        // immutable
    var count = 0            // mutable
    count = count + 3
    print($"hello from {name}, count = {count}")
    return 0
}
$ milo run values.milo
hello from Milo, count = 3

Takeaway You always know which bindings can change under you: only the ones marked var.