04 - Getting Started
There are two normal ways to use Verge: run a single .v file directly, or set up a proper
project. Both are fine — one is quicker, the other is easier to maintain as it grows.
Single-file mode
For quick experiments, write a file and run it directly. No manifest, no directory structure, no ceremony:
import std.io
main: f() {
io.writeln("hello from a single file")
}
verge run hello.v
hello from a single file
This is the fast path — ideal for learning, small scripts, and confirming your toolchain works. Every example in these docs is a single file exactly like this one.
Project mode
When the code is going to grow beyond a quick experiment, start a project instead:
verge init myproject
cd myproject
verge run
verge init scaffolds two files:
myproject/verge.toml— the project manifest.myproject/main.v— the entry file.
The generated main.v is deliberately minimal — a main that compiles and exits cleanly:
main: f() => i32 = 0
main here returns an i32, and that value becomes the process exit code. Returning 0
means “success”. You’ll usually replace this with something that actually does work — often
one that omits the return type entirely, in which case the exit code defaults to 0.
What verge.toml is for
verge.toml is the project manifest. A fresh one looks like this:
[package]
name = "myproject"
version = "0.1.0"
author = ""
description = ""
[dependencies]
[package]holds metadata:name,version,author,description.[dependencies]lists external packages. You rarely edit this by hand —verge addandverge fetchmanage it for you.
You don’t need to memorise every field on day one. You mostly need to know the file exists and that it’s where project-level settings live.
verge run vs verge build
verge runcompiles the program and immediately runs it.verge buildcompiles it and stops, leaving you the binary.
When you’re iterating, use verge run. When you just want the artifact, use verge build.
Both accept either a single file (verge run hello.v) or, with no argument, the project in
the current directory (they read verge.toml and start from main.v).
That’s enough to get moving: start with one file, and switch to a project when it stops fitting in one file.