Added trivial fibonacci implementation
ci/woodpecker/push/woodpecker Pipeline was successful
Details
ci/woodpecker/push/woodpecker Pipeline was successful
Details
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() {
|
fn main() {
|
||||||
println('Hello, world!')
|
println('Hello, world!')
|
||||||
|
|
||||||
|
for i in 1 .. 35 {
|
||||||
|
println('$i - ${fibonacci.fib(i)}')
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue