Files
pork/examples/fib.pork

14 lines
173 B
Plaintext
Raw Normal View History

2023-08-21 02:15:52 -07:00
/* fibonacci sequence */
2023-09-02 20:22:08 -07:00
fn fib(n) {
2023-08-19 20:40:31 -07:00
if n == 0
then 0
else if n == 1
then 1
else fib(n - 1) + fib(n - 2)
}
2023-08-19 20:59:14 -07:00
2023-09-02 20:22:08 -07:00
fn main() {
result = fib(20)
println(result)
}