mirror of
https://git.sfja.dk/Mikkel/slige.git
synced 2025-07-05 18:56:56 +01:00
Compare commits
2 Commits
f990e57c85
...
8c00000ea4
Author | SHA1 | Date | |
---|---|---|---|
|
8c00000ea4 | ||
d12d3b9923 |
22
examples/test_mul_fixed.slg
Normal file
22
examples/test_mul_fixed.slg
Normal file
@ -0,0 +1,22 @@
|
||||
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 {
|
||||
println("test 1 passed")
|
||||
}
|
||||
if mul(3,2) == 6 {
|
||||
println("test 2 passed")
|
||||
}
|
||||
if mul(0,2) == 0 {
|
||||
println("test 3 passed")
|
||||
}
|
||||
}
|
BIN
tk_rap.odt
BIN
tk_rap.odt
Binary file not shown.
BIN
usecase_dos.odt
Normal file
BIN
usecase_dos.odt
Normal file
Binary file not shown.
Loading…
Reference in New Issue
Block a user