cpp-peglib/language/culebra/samples/fib.cul
2015-08-05 08:22:43 -04:00

18 lines
183 B
Plaintext

/*
* Fibonacci
*/
fib = fn (x) {
if x < 2 {
x
} else {
self(x - 2) + self(x -1)
}
}
mut i = 0
while i < 30 {
puts("{i}: {fib(i)}")
i = i + 1
}