forked from vieter-v/vieter
Added trivial fibonacci implementation
parent
d80d320483
commit
fff440ee98
|
@ -0,0 +1,9 @@
|
|||
module fibonacci
|
||||
|
||||
pub fn fib(i int) int {
|
||||
if i <= 1 {
|
||||
return i
|
||||
}
|
||||
|
||||
return fib(i - 1) + fib(i - 2)
|
||||
}
|
|
@ -1,3 +1,9 @@
|
|||
import fibonacci
|
||||
|
||||
fn main() {
|
||||
println('Hello, world!')
|
||||
|
||||
for i in 1 .. 35 {
|
||||
println('$i - ${fibonacci.fib(i)}')
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue