Getting started

This guide teaches NanoLang in the canonical style (prefix notation, explicit types, and shadow tests).

NanoLang Mascot
← PreviousStart

Hello world


fn hello_message() -> string {
    return "Hello, NanoLang!"
}

shadow hello_message {
    assert (== (hello_message) "Hello, NanoLang!")
}

fn main() -> int {
    (println (hello_message))
    return 0
}

shadow main { assert true }

Basic arithmetic and return values


fn add3(a: int, b: int, c: int) -> int {
    return (+ a (+ b c))
}

shadow add3 {
    assert (== (add3 1 2 3) 6)
}

fn main() -> int {
    assert (== (add3 10 20 30) 60)
    return 0
}

shadow main { assert true }
← PreviousStart