The forEachIndex function evaluates each element of the list and provides the element's index:
println("Print elements with index")
numbers.forEachIndexed { index, element -> println("Element $element at index $index") }
The forEachIndex function evaluates each element of the list and provides the element's index:
println("Print elements with index")
numbers.forEachIndexed { index, element -> println("Element $element at index $index") }
3.144.35.122