Files
kotlin/compiler/testData/codegen/box/controlStructures/forInArrayWithIndex/forInArrayOfPrimArrayWithIndex.kt
2019-11-19 11:00:09 +03:00

16 lines
320 B
Kotlin
Vendored

// IGNORE_BACKEND_FIR: JVM_IR
// KJS_WITH_FULL_RUNTIME
// WITH_RUNTIME
fun box(): String {
// [[0], [1], [2], [3]]
val arr = Array(4) { intArrayOf(it) }
var s = 0
for ((i, iarr) in arr.withIndex()) {
s += i*iarr[0]
}
// 0 + 1 + 4 + 9 = 14
return if (s != 14) "Fail: $s" else "OK"
}