Iteration

Report a typo

Choose all the possible ways to loop through and print each element in array.

a)

for (element in array) {
    println(element)
}

b)

for (index in indices) {
    println(index)
}

c)

for (index in array.indices){
    println(array[index])
}

d)

for (index in array.lastIndex downTo 0 step 6) {
    println(array[index])
}

e)

for (index in 0..array.lastIndex step 1) {
    println(array[index])
}
Select one or more options from the list
___

Create a free account to access the full topic