mirror of
https://github.com/jlengrand/kotlin.git
synced 2026-05-08 00:21:26 +00:00
12 lines
237 B
Kotlin
Vendored
12 lines
237 B
Kotlin
Vendored
package kotlin.scripting.fibonacci
|
|
// this script expected parameter num : Int
|
|
|
|
fun fib(n: Int): Int {
|
|
val v = if(n < 2) 1 else fib(n-1) + fib(n-2)
|
|
println("fib($n)=$v")
|
|
return v
|
|
}
|
|
|
|
println("num: $num")
|
|
val result = fib(num)
|