Ruka is an opinionated language focused on simplicity and useability, opt in to fine control when needed. Write what you mean; let the compiler fill in the rest.
Pick an example to run it in-browser.
A few features that shape how Ruka feels to write.
let name = "Ruka"
let answer = 42
let lookup = (key: string) -> ?(int) do ...let label = "pass" if score >= 60 else "fail"
let grade = match score with
90..=100 do "A"
80..=89 do "B"
else "C"
endlet @private = .. // private / local
let consume = (&buf) do .. // takes ownership; mutable
let fast = ($data) do .. // copied to stack; mutable
let repeat = (*n) do .. // n is borrowed; mutable
let work = () do
let counter = 0 // mutable by default at runtime scope
let #lut = build_table() // forced compile-time evaluation
endlet shape = behaviour {
area(self): () -> f64
perimeter(self): () -> f64
}
let describe = (s: shape) do
ruka.println("area=${s.area()}")
endlet (x, y) = point // tuple destructuring
let {name, age} = person // record destructuring
if some(name) = lookup(id) do
ruka.println("hello, ${name}")
end
for ok(row) in rows do
handle(row) // rows that don't match ok(_) are skipped
endlet @add = (a, b) do a + b
test addition = () do
ruka.expect_eq(add(1, 2), 3)
ruka.expect_eq(add(0, 0), 0)
end