Files
kotlin/compiler/testData/codegen/box/controlStructures/forIntArray.kt
Denis Zharkov 654411a0b0 Refactored tests using Array constructor:
Some moved to tests with stdlib
Some changed to use arrayOfNulls
2014-12-11 16:04:03 +03:00

15 lines
250 B
Kotlin

fun box() : String {
val a = arrayOfNulls<Int>(5)
var i = 0
var sum = 0
for(el in 0..4) {
a[i] = i++
}
for (el in (a as Array<Int>)) {
sum = sum + el
}
if(sum != 10) return "a failed"
return "OK"
}