Skip to content

Ard

Easy to read,
write, and rely on.

Ard is a general-purpose programming language with static typing, errors as values, and explicit mutable data access.

Ard is usable today, but it is still evolving and breaking changes are possible.

fibonacci.ardARD
use go:fmt
fn fib(n: Int) Int {
match n <= 1 {
true => n,
false => fib(n - 2) + fib(n - 1),
}
}
fn main() {
for n in 20 {
fmt::Println("fib({n}) = {fib(n)}")
}
}

What Ard makes explicit

Ard has dedicated syntax for optional values, recoverable errors, and mutable data access.

Optional values

Optional values use T? rather than nil, pointers, or zero values. The absent case must be handled before the value can be used.

let user: User? = find_user(id)
let name = user
  .map(fn(u) { u.name })
  .or(“guest”)

Errors as values

Functions that can fail return Results (Val!Err). Callers can handle the error where recovery is possible or propagate it with try.

fn divide(a: Int, b: Int) Int!Str {
  match b == 0 {
    true => Result::err(“division by zero”),
    false => Result::ok(a / b),
  }
}

Mutable access

The mut keyword makes mutation explicit for mutable bindings, references, and methods that can modify their receiver in place.

impl Board {
  fn mut play(player: Str, pos: Int) {
    self.cells.set(pos, player)
  }
}

Ard compiles to Go.

Ard programs use Go’s robust runtime and standard library, with cross-platform support and performance suitable for general application development. Go packages can also be imported directly.

Read about Go interoperability
Ard sourceGo package
use go:net/http as http
use go:fmt
fn main() {
let response = http::Get(
"https://ard-lang.dev"
).expect("request")
fmt::Println(response.Status)
}