mirror of
https://github.com/jlengrand/kotlin.git
synced 2026-05-10 15:53:46 +00:00
13 lines
344 B
Kotlin
Vendored
13 lines
344 B
Kotlin
Vendored
// TODO: muted automatically, investigate should it be ran for JS or not
|
|
// DONT_RUN_GENERATED_CODE: JS
|
|
|
|
tailrec fun sum(x: Long, sum: Long): Long {
|
|
if (x == 0.toLong()) return sum
|
|
return sum(x - 1, sum + x)
|
|
}
|
|
|
|
fun box() : String {
|
|
val sum = sum(1000000, 0)
|
|
if (sum != 500000500000.toLong()) return "Fail $sum"
|
|
return "OK"
|
|
} |