Quickstart

This quickstart is the shortest path from no Alef knowledge to a running program.

1. Create A Folder


mkdir alef-learning
cd alef-learning

2. Create main.alef


fn main() {
    let name = "Alef"
    println("Hello, {name}")
}

3. Run It


alef run main.alef
Output

Hello, Alef

4. Add A Function


fn priority(plan, blocked) {
    if plan == "enterprise" and blocked {
        return "P0"
    }
    return "P2"
}

fn main() {
    println(priority("enterprise", true))
}
Output

P0

5. Add Data


fn priority(plan, blocked) {
    if plan == "enterprise" and blocked {
        return "P0"
    }
    return "P2"
}

fn main() {
    let ticket = {
        "id" => "TD-101",
        "title" => "Checkout timeout",
        "plan" => "enterprise",
        "blocked" => true
    }

    let p = priority(ticket["plan"], ticket["blocked"])
    let id = ticket["id"]
    println("{id}: {p}")
}
Output

TD-101: P0

What You Just Learned

Next, read the Language Tour, then the book chapters on syntax, control flow, collections, and errors.