Skip to content

Your first program

Follow this page exactly after Install. Every command assumes you have vow on your PATH.

Terminal window
vow new hello-app
cd hello-app
ls src/main.vow project.toml

vow new creates:

File Purpose
src/main.vow Entry point (main in project.toml)
project.toml Project name, version, deps
vow.lock Lockfile (empty deps initially)
README.md Build/run commands

Default src/main.vow:

fn main(caps: Caps) -> int {
print("Hello from Vow!")
return 0
}

Every program’s entry point is fn main(caps: Caps) -> int. Capabilities enter only here. If you never use caps, you still must declare it.

Terminal window
vow check src/main.vow

Expected: ok: src/main.vow

Terminal window
vow run src/main.vow
echo $?

Expected output includes Hello from Vow! and exit code 0.

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

The -o name can match the project name or anything you like; it is not required to be hello.vow.

You do not need vow new for a one-off script. Create hello.vow in any directory:

fn main(caps: Caps) -> int {
return 1 + 2;
}
Terminal window
vow build hello.vow -o hello
./hello
echo $? # 3

Or vow run hello.vow.

  • Integers: int, int64 (no implicit mix — use as)
  • bool, heap String, Array<T>
  • Prelude: Option<T>, Result<T, E>no null
  • Structs, enums, match (exhaustive)
fn unwrap_or(opt: Option<int>, fallback: int) -> int {
return match opt {
Some(x) => x,
None => fallback
};
}