Files
kotlin/compiler/testData/codegen/box/controlStructures/forInArrayWithIndex/forInIntArrrayWithIndex.kt
2018-06-09 19:15:38 +03:00

13 lines
303 B
Kotlin
Vendored

// IGNORE_BACKEND: JS_IR
// WITH_RUNTIME
val arr = intArrayOf(10, 20, 30, 40)
fun box(): String {
val s = StringBuilder()
for ((index, x) in arr.withIndex()) {
s.append("$index:$x;")
}
val ss = s.toString()
return if (ss == "0:10;1:20;2:30;3:40;") "OK" else "fail: '$ss'"
}