holey-bytes/hblang/examples/if_statement.hb

13 lines
140 B
Plaintext
Raw Normal View History

2024-05-11 15:22:08 -05:00
main := fn(): int {
return fib(10);
}
2024-05-11 15:22:08 -05:00
fib := fn(x: int): int {
if x <= 2 {
return 1;
2024-05-11 11:16:27 -05:00
} else {
return fib(x - 1) + fib(x - 2);
}
}