Statically compiled. LLVM-powered.
Every construct. Deterministic. No surprises.
# primitive types
int x = 42
double pi = 3.14
string name = "zen"
bool flag = true
# type inference
auto result = x * 2
# constants
int const MAX = 1000
# reactive (re-evaluates on change)
reactive string msg = `val: ${x}`
# typed function
fn add(int a, int b) int {
return a + b
}
# auto return type
fn greet(string name) auto {
return `Hello, ${name}!`
}
# rest parameters
fn sum(int vals...) List<int> {
return vals
}
# c-style loop
loop (int i = 0, i < 10, i++) {
screen(i)
}
# while
while (x > 0) { x-- }
# do while
do {
screen(x)
} while (x > 0)
# iterate List or fixed size arrays kr rest params
loop (n of nums) {
screen(n)
}
# iterate map
loop (k in person) {
screen(k)
}
# typed list
List<int> nums = [1, 2, 3]
nums.push(4)
int len = nums.length
# map
Map person = {
name: "Achu",
age: 25
}
bool has = person.has("name")
person.remove("age")
free(). Predictable performance, no GC pauses.// then: zen run hello.zen