Function
This example defines two functions, add
and compute
.
The add
function takes two arguments, a
and b
, and returns their sum.
The compute
function takes no arguments and returns nothing.
Its return type is Unit
, which is used to represent the absence of a return value.
fn add(a : Int, b : Int) -> Int {
return a + b
}
fn compute() -> Unit {
println(add(2, 40))
}
fn main {
compute()
}