blob: 851404707d98390f054311659097c948693ba0d0 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
fn difference a: int, b: int -> _/eax: int {
var result/eax: int <- copy a
result <- subtract b
compare result, 0
{
break-if->=
result <- negate
}
return result
}
fn test-difference {
var result/eax: int <- difference 5, 3
check-ints-equal result, 2, "F - difference works"
result <- difference 3, 5
check-ints-equal result, 2, "F - difference is always positive"
result <- difference 6, 6
check-ints-equal result, 0, "F - difference can be 0"
}
fn main screen: (addr screen) {
}
|