1. Learning Alef From Zero

This chapter is for the reader who opens the docs and asks: "What do I do first?"

Alef is a programming language. That means you write source files, run them with a command, and build programs out of values, functions, control flow, data, and modules.

An Alef file usually looks like this:


fn main() {
    println("hello, Alef")
}

Save it as main.alef, then run:


alef run main.alef
Output

hello, Alef

That is the basic loop:

  1. Edit a .alef file.
  2. Run it.
  3. Read the output or error.
  4. Change the program.

What A Program Is

A program is a set of instructions for the runtime. In Alef, the runtime starts with main.


fn main() {
    let name = "Ada"
    println("hello, {name}")
}

Line by line:

The Four Things To Learn First

Every beginner should learn these before standard-library details:

  1. Values: strings, numbers, booleans, arrays, maps.
  2. Functions: named blocks of reusable behavior.
  3. Control flow: if, for, while, and match.
  4. Data modeling: maps for flexible data, structs/enums for named shapes.

This book teaches those in that order.

Alef Is Not The Source Repository

The public Alef experience is:

The compiler and native runtime implementation can remain private. A user does not need to read the private source tree to learn or run Alef programs.

What Makes Alef Different

Alef tries to make modern backend work feel like ordinary language work:

That comes later. First, write and run small programs.