How to get the index in a for each loop? I want to print numbers for every second iteration
For example
for (value in collection) { if (iteration_no %
forEachIndexed
Iterate with Index
itemList.forEachIndexed{index, item -> println("index = $index, item = $item ") }
Update List using Index
itemList.forEachIndexed{ index, item -> item.isSelected= position==index}