blob: 96c38776888e0227a6d5d3c361194dd9cb31a090 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
|
if/else-if/else chains and nested conditionals emit as a single
chained `if () { } else if () { } else { }` c block.
<<<
classify = fun (n int) int {
if n < 0 {
return -1
} else if n == 0 {
return 0
} else {
return 1
}
}
main = fun () {
classify(5)
}
>>>
#include "core.c"
integer classify(integer n);
void catskill_main(void);
integer classify(integer n) {
if (n < 0) {
return -1;
} else if (n == 0) {
return 0;
} else {
return 1;
}
}
void catskill_main(void) {
classify(5);
}
#include "runtime.c"
|