Standard Library

Four built-in modules — math, file, sys, time — plus global print and log. No imports needed.

Auto-imported: Modules are resolved at compile time. The code generator emits the needed Go imports only when you actually call a module function.

Built-in Functions

print(value)

Prints any value to stdout followed by a newline.

print("Hello")          // Hello
print(42)                // 42
print("x={x}, y={y}")   // interpolation works

log(level, message)

Structured logging with a timestamp, level tag, and message.

log("INFO", "Server started on port 8080")
// [INFO] 2026/09/27 18:36:27 Server started on port 8080

log("ERROR", "Database connection failed")
// [ERROR] 2026/09/27 18:36:27 Database connection failed

math

Mathematical functions. Arguments are type-checked strictly.

FunctionSignatureDescription
math.sqrt(dec) decSquare root. Negative input returns NaN.
math.pow(dec, dec) decRaises x to the power y.
math.abs(int) intAbsolute value. Requires int.
math.round(dec) intRound half-away-from-zero.
math.rand(int, int) intPseudo-random int in [lo, hi] inclusive.
val root = math.sqrt(16)           // 4.0
val area = math.pow(10, 2)         // 100.0
val diff = math.abs(-45)            // 45
val r    = math.round(4.7)          // 5
val dice = math.rand(1, 6)          // 1..6
Strict args: math.abs(3.14) fails with argument 1 expects int, got dec. Use math.round first if you need to convert.

file

File system operations. All functions panic on I/O failure with a descriptive message.

FunctionSignatureDescription
file.write(path: str, content: str)Create/overwrite a file.
file.append(path: str, content: str)Append to a file (creates if missing).
file.read(path: str) strRead entire file into a string.
file.exists(path: str) boolCheck whether a path exists.
file.delete(path: str)Delete a file. Panics if missing.
file.write("config.json", `{"debug": true}`)
file.append("access.log", "{time.now()} - Request\n")

if file.exists("cache.dat") {
    val data = file.read("cache.dat")
}

file.delete("temp.tmp")
Safe pattern: Always check file.exists before file.read or file.delete when the operation is optional.

sys

FunctionSignatureDescription
sys.env(name: str) strEnvironment variable, or empty string.
val port  = sys.env("PORT") or "8080"
val db    = sys.env("DATABASE_URL")
val debug = sys.env("DEBUG") == "1"

time

FunctionSignatureDescription
time.now() strCurrent local time as 2006-01-02 15:04:05.
time.sleep(ms: int)Block for the given milliseconds.
val started = time.now()
print("Booted at {started}")

time.sleep(2000)   // wait 2 seconds

String Methods

Available on every str value:

MethodReturnsExample
s.len()int"abc".len() → 3
s.upper()str"hi".upper() → "HI"
s.lower()str"HI".lower() → "hi"
s.contains(x)bool"hello".contains("ell") → true

Array Methods

MethodReturnsDescription
a.len()intNumber of elements.
a.push(x)voidAppend an element (requires mut).

Quick Reference

// Output
print(value)                          log(level, msg)

// Math
math.sqrt(x)   math.pow(x, y)   math.abs(n)
math.round(x)  math.rand(lo, hi)

// File
file.write(p, c)  file.append(p, c)  file.read(p)
file.exists(p)    file.delete(p)

// System
sys.env(name)

// Time
time.now()  time.sleep(ms)