Skip to content

Quick Start

Get up and running with MOL in 2 minutes.

Hello World

Create a file hello.mol:

show "Hello, World!"

Run it:

mol run hello.mol

Output:

Hello, World!

Variables

let name be "MOL"
let version be 0.2
let features be ["pipes", "guards", "types"]

show name + " v" + to_text(version)
show "Features: " + join(features, ", ")

Pipe Operator

The killer feature — chain operations with |>:

let result be "  Hello World  " |> trim |> upper |> split(" ")
show result
-- Output: ["HELLO", "WORLD"]

With 3+ stages, MOL auto-traces the pipeline:

  ┌─ Pipeline Trace ──────────────────────────────────────
  │ 0.  input                   ─  Text("  Hello World  ")
  │ 1.  trim                0.0ms  → Text("Hello World")
  │ 2.  upper               0.0ms  → Text("HELLO WORLD")
  │ 3.  split(" ")          0.0ms  → List<2 strs>
  └─ 3 steps · 0.0ms total ───────────────────────────

Functions

fn double(x)
  return x * 2
end

fn add_ten(x)
  return x + 10
end

show 5 |> double |> add_ten |> double
-- Output: 40

REPL

Start an interactive session:

mol repl
MOL v0.2.0 REPL
Type MOL code. Use \ for multi-line. Ctrl+C to exit.
mol> show "hello" |> upper
HELLO
mol> let x be 42
mol> show x * 2
84

Next Steps