Files
kotlin/compiler/testData/codegen/box/controlStructures/forInSequenceWithIndex/forInSequenceWithIndex.kt

15 lines
312 B
Kotlin
Vendored

// KJS_WITH_FULL_RUNTIME
// WITH_RUNTIME
val xs = listOf("a", "b", "c", "d").asSequence()
fun box(): String {
val s = StringBuilder()
for ((index, x) in xs.withIndex()) {
s.append("$index:$x;")
}
val ss = s.toString()
return if (ss == "0:a;1:b;2:c;3:d;") "OK" else "fail: '$ss'"
}