티스토리 뷰

728x90
collection.forEachIndexed { index, element ->
    // ...
}

https://stackoverflow.com/questions/48898102/how-to-get-the-current-index-in-for-each-kotlin

 

How to get the current index in for each Kotlin

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 % 2) { //do something } } In ja...

stackoverflow.com

 

 

728x90
댓글