slige/examples/test_mul.slg

20 lines
351 B
Plaintext
Raw Permalink Normal View History

2024-12-16 15:33:12 +01:00
fn print(msg: string) #[builtin(Print)] {}
fn println(msg: string) { print(msg + "\n") }
fn mul(left: int, right: int) -> int {
if left == 0 or right == 0 {
0
} else {
left * right
}
}
fn main() {
if mul(10,2) == 20 {
print("test 1 passed")
}
if mul(3,2) == 6 {
print("test 2 passed")
}
}