Added trivial fibonacci implementation

main
Jef Roosens 2022-01-08 23:14:07 +01:00
parent d80d320483
commit fff440ee98
Signed by untrusted user: Jef Roosens
GPG Key ID: 955C0660072F691F
2 changed files with 15 additions and 0 deletions

View File

@ -0,0 +1,9 @@
module fibonacci
pub fn fib(i int) int {
if i <= 1 {
return i
}
return fib(i - 1) + fib(i - 2)
}

View File

@ -1,3 +1,9 @@
import fibonacci
fn main() {
println('Hello, world!')
for i in 1 .. 35 {
println('$i - ${fibonacci.fib(i)}')
}
}