Hello World

Let's write your first Aria program.

The Simplest Program

Create a file called main.aria:

mod main

entry {
    println("Hello, Aria!")
}

Every Aria program needs:

  • mod main — declares this file belongs to the main module
  • entry { ... } — the program entry point (replaces main() functions)

Compile and Run

aria build main.aria
./main

Adding a Function

mod main

fn greet(name: str) -> str = "Hello, {name}!"

entry {
    println(greet("world"))
}

Key things to notice:

  • Single-expression functions use = expr syntax — no braces, no return
  • String interpolation uses {expr} directly inside strings
  • No semicolons — newlines terminate statements

Working with Variables

mod main

entry {
    // Immutable binding (default)
    name := "Aria"
    version := 0.1

    // Mutable binding
    mut count := 0
    count = count + 1

    // Explicit type
    port: u16 = 8080

    // Compile-time constant
    const MAX_RETRIES = 3

    println("{name} v{version} on port {port}")
}

A Slightly Bigger Example

mod main

type Person {
    name: str
    age: i64
}

fn describe(p: Person) -> str =
    "{p.name} is {p.age} years old"

entry {
    people := [
        Person{name: "Alice", age: 30},
        Person{name: "Bob", age: 25},
    ]

    for p in people {
        println(describe(p))
    }
}

Next Steps