Skip to content

First Program

Create a file called hello.zp:

import "std/io" { println };
fun main() Int {
println("Hello, Zap!");
return 0;
}

Compile it with the compiler built from zap/:

Terminal window
./zap/build/zapc hello.zp

By default, zapc builds an executable. On Unix-like systems, if you did not pass -o, the output is a.out:

Terminal window
./a.out
  • main usually returns Int.
  • Statements end with ;.
  • Import functions from std/io for console output.
  • If you use raw pointers or manual allocation later, compile with --allow-unsafe.