Files
kotlin/compiler/testData/script/fib.pkg.kts
Ilya Ryzhenkov 98c54f39bb Unify script file extensions to "kts" so that IDEA, compiler and tests agree when to parse as SCRIPT.
Include kt* files into formatter test generation, to test scripting formatting
2014-03-24 18:17:50 +04:00

12 lines
259 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)
System.out.println("fib($n)=$v")
return v
}
System.out.println("num: $num")
val result = fib(num)