Skip to content

Basics

Every Vow program starts the same way:

fn main(caps: Caps) -> int {
return 1 + 2
}

From a vow new project (file is src/main.vow):

Terminal window
vow build src/main.vow -o app
./app
echo $? # 3

Or vow run src/main.vow. For a single file named hello.vow, use vow build hello.vow -o hello instead.

Capabilities always enter through caps — even when unused.

Keyword Meaning
let Immutable binding
var Mutable binding
Parameters Always immutable
fn main(caps: Caps) -> int {
let greeting = "hello"
var count = 0
count = count + 1
count += 1
print greeting, count
return count
}

Compound assign: += -= *= /=. Statement-only i++ / i-- (not x = i++).

Write Notes
int, int64 No implicit mix — cast with as
f32, f64 Float literals default to f64
bool true / false
String Heap string
Array<T> Not List
Map<String, V> String keys only (v1)
Option<T>, Result<T, E> Prelude — no null

Aliases the compiler accepts: i32int, i64int64, stringString, float/doublef64. Prefer the canonical names in new code.

type Score = int
fn main(caps: Caps) -> int {
let s: Score = 42
let wide = s as int64
return s
}
// line comments only — no /* block */ yet
let n = 42
let pi = 3.14
let ok = true
let name = "Ada"
let nums = [1, 2, 3]

Semicolons are optional in most places (phase4_syntax.vow). Keep them if you prefer; vow fmt will not invent a second style fight for you.

Top-level function is an alias of fn. Methods and interface methods use fn only. vow fmt normalizes functionfn.

function bump(x: int) -> int {
return x + 1
}
// fragment-only
print 1, true, "ok"
eprint "debug:", 0