-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest.poop
53 lines (46 loc) · 790 Bytes
/
test.poop
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
fn test_comparison() {
printf("Comparison test <: %d
", 5 < 10);
printf("Comparison test < (fail): %d
", 10 < 5);
printf("Comparison test < (equal): %d
", 5 < 5);
printf("Comparison test < (not true): %d
", !5 < 10);
}
fn test_if(test: bool) -> int {
if test {
if !test {
2
} else {
5
}
} else {
3
}
}
fn fac(n: int) -> int {
if n < 2 {
n
} else {
n * fac(n - 1)
}
}
fn calc(a: int) -> int {
let x = 5 + 10;
let z = {
let y = x + 2;
5
};
x + 4 * y + z + a
}
fn main() -> int {
printf("Output: %d
", calc(1));
test_comparison();
printf("Testing if: %d
", test_if(true));
printf("Factorial of 10: %d
", fac(10));
!true
}