cpp-peglib/language/samples/fib.cul

18 lines
183 B
Plaintext
Raw Normal View History

/*
* Fibonacci
*/
fib = fn (x) {
if x < 2 {
x
} else {
self(x - 2) + self(x -1)
}
}
mut i = 0
while i < 30 {
2015-07-08 17:15:41 +00:00
puts("{i}: {fib(i)}")
i = i + 1
}