holey-bytes/hblang/examples/loops.hb

20 lines
192 B
Plaintext
Raw Normal View History

2024-05-11 15:22:08 -05:00
main := fn(): int {
2024-05-11 11:16:27 -05:00
return fib(10);
}
2024-05-11 15:22:08 -05:00
fib := fn(n: int): int {
2024-05-11 11:16:27 -05:00
a := 0;
b := 1;
loop {
c := a + b;
a = b;
b = c;
n = n - 1;
if n == 0 {
break;
}
continue;
}
return a;
}