To iterate an array without allocating extra objects you can use one of the following ways.
for-loop
for (e in arr) {
println(e)
}
forEachextension
arr.forEach {
println(it)
}
forEachIndexedextension, if you need to know index of each element
arr.forEachIndexed { index, e ->
println("$e at $index")
}