mirror of
https://github.com/jlengrand/kotlin.git
synced 2026-05-09 00:21:47 +00:00
Intrinsics for 'reversed': array.indices
#KT-21323 In Progress
This commit is contained in:
15
compiler/testData/codegen/bytecodeText/forLoop/forInReversed/forInReversedArrayIndices.kt
vendored
Normal file
15
compiler/testData/codegen/bytecodeText/forLoop/forInReversed/forInReversedArrayIndices.kt
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
// WITH_RUNTIME
|
||||
import kotlin.test.*
|
||||
|
||||
fun box(): String {
|
||||
val arr = intArrayOf(1, 1, 1, 1)
|
||||
var sum = 0
|
||||
for (i in arr.indices.reversed()) {
|
||||
sum = sum * 10 + i + arr[i]
|
||||
}
|
||||
assertEquals(4321, sum)
|
||||
|
||||
return "OK"
|
||||
}
|
||||
|
||||
// 0 reversed
|
||||
Reference in New Issue
Block a user