Files
nub-lang/examples/math/math.nub
nub31 b7dc77cb1c ...
2026-02-26 20:57:25 +01:00

40 lines
492 B
Plaintext

module math
export struct Human {
name: string
age: i32
}
export struct Pos {
x: i32
y: i32
}
export enum Message {
Quit: {}
Move: Pos
}
export func add(a: i32 b: i32): i32
{
let msg: Message = enum Message::Move {
x = 10
y = 10
}
match msg {
Quit q {
// quit
}
Move m {
// move
}
}
return add_internal(a b)
}
func add_internal(a: i32 b: i32): i32
{
return a + b
}