Files
kotlin-fork/compiler/testData/codegen/box/strings/forInString.kt
T
Mikhail Glukhikh 56c819f06e FIR2IR: add two-statements block with iterator + while for 'for' loops
Before this commit we had two statements blocks for 'for' loops:
range variable declaration + iterator variable declaration + while loop.
However, BE requires a bit different loop structure to make lowerings
properly so in this commit iterator declaration & while loop were
extracted to separate block.
2020-02-17 20:35:17 +03:00

15 lines
239 B
Kotlin
Vendored

// KJS_WITH_FULL_RUNTIME
// WITH_RUNTIME
fun foo(): Int {
var sum = 0
for (c in "239")
sum += (c.toInt() - '0'.toInt())
return sum
}
fun box(): String {
val f = foo()
return if (f == 14) "OK" else "Fail $f"
}