Files
kotlin/compiler/testData/codegen/box/controlStructures/forInArrayWithIndex/forInGenericArrayOfIntsWithIndex.kt
2018-09-18 14:36:20 +03:00

12 lines
275 B
Kotlin
Vendored

// WITH_RUNTIME
val arr = arrayOf(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'"
}