Skip to main content

Syntax Overview

Basic Structure​

Zerolang source files use the .0 extension.

fn answer() -> i32 {
return 40 + 2
}

pub fn main(world: World) -> Void raises {
if answer() == 42 {
check world.out.write("math works\n")
}
}

Functions​

fn function_name(parameter: Type) -> ReturnType {
// body
}
  • pub marks a function as public
  • raises marks a function as fallible (may fail)

Types​

TypeDescription
i3232-bit signed integer
VoidNo return value
BoolBoolean
StringString

Control Flow​

if condition {
// ...
} else {
// ...
}

Effects and Capabilities​

In Zerolang, all external-world access must go through explicit capabilities:

pub fn main(world: World) -> Void raises {
check world.out.write("hello\n")
}

The world parameter provides access to external capabilities. The check keyword marks operations that may fail.

Ownership and Borrowing​

(Detailed documentation coming soon. Refer to the latest official release for current syntax.)