-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfor.mank
49 lines (44 loc) · 784 Bytes
/
for.mank
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
fun test: i32 {
count: i32 = 0;
for x: i32 in 0 .. 10 {
count = count + 1;
}
return count;
}
fun fib_iter: i32 (n: i32) {
a: i32 = 0;
b: i32 = 1;
for _: i32 in 0 .. (n - 1) {
temp: i32 = b;
b = a + b;
a = temp;
}
return b;
}
fun huh: i32 {
return 10;
# return 20;
}
fun nesting_stuff: i32 {
something: i32 = 0;
for x: i32 in 0 .. 10 {
for y: i32 in 10 .. 20 {
for z: i32 in 20 .. 30 {
something = something + 1;
}
if (something % 2 == 0) {
something = something - 1;
return something;
}
}
if ((something + 1) % 3 == 1) {
something = something / 2;
} else {
return something;
}
if (something - 1 == 0) {
return - 1;
}
}
return something;
}