Skip to content

Hello, World

Vertex programs are run locally with:

vertex run <file.vtx>

There is no main function. Vertex programs execute top-level statements in order, top to bottom.

debug is the only way to produce observable output in Vertex. It is an expression. It evaluates its argument, prints it, and returns the value.

debug "hello, world!"
debug 42
debug true

Output:

hello, world!
42
true

You can use debug anywhere an expression is valid. In the middle of a calculation, inside a match arm, as a function argument.

Use let to bind a name to a value:

let name = "Alice"
let answer = 42
debug "Hello, ${name}! The answer is ${answer}."

Output:

Hello, Alice! The answer is 42.

All bindings are immutable by default. To allow reassignment, use mutable let:

mutable let count = 0
count = count + 1
count = count + 1
debug count // 2

Trying to reassign an immutable let binding is a compile-time error.