mirror of
https://github.com/jlengrand/kotlin.git
synced 2026-05-13 08:31:31 +00:00
21 lines
424 B
Kotlin
21 lines
424 B
Kotlin
tailRecursive fun test(x : Int, e : Any) : Unit {
|
|
if (x == 1) {
|
|
test(x - 1, "tail")
|
|
} else if (x == 2) {
|
|
test(x - 1, "tail")
|
|
return
|
|
} else if (x == 3) {
|
|
test(x - 1, "no tail")
|
|
if (x == 3) {
|
|
test(x - 1, "tail")
|
|
}
|
|
return
|
|
} else if (x > 0) {
|
|
test(x - 1, "tail")
|
|
}
|
|
}
|
|
|
|
fun box() : String {
|
|
test(1000000, "test")
|
|
return "OK"
|
|
} |