Hello, World
Running Vertex
Section titled “Running Vertex”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.
Your first output
Section titled “Your first output”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 42debug trueOutput:
hello, world!42trueYou can use debug anywhere an expression is valid. In the middle of a calculation, inside a match arm, as a function argument.
Bindings
Section titled “Bindings”Use let to bind a name to a value:
let name = "Alice"let answer = 42debug "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 = 0count = count + 1count = count + 1debug count // 2Trying to reassign an immutable let binding is a compile-time error.
Next steps
Section titled “Next steps”- Primitive Types: the built-in types available in Vertex
- Bindings: full binding reference
- Output,
debugin depth