Functions
Functions are declared with fn. Parameter types are required. Parameters use name type syntax (no colon).
use system.io.{print}
// With explicit return
fn add(a int, b int) int
return a + b
// With implicit return
fn sub(a int, b int) int
a - b
// Inline body
fn greet(name string): print(f"Hello, {name}!")
fn main()
let sum = add(10, 20)
let diff = sub(10, 20)
greet("World")
print(f"Sum: {sum}")
print(f"Diff: {diff}")
Functions without a return type implicitly return void. Functions support named arguments at the call site.