Modernizing Iteration Practices
Learn to optimize loops and leverage modern techniques for efficient coding.
We'll cover the following...
We'll cover the following...
Explicit index iteration
Developers with experience in older languages often use a for loop where slightly more modern alternatives should be used instead.
Kotlin 1.5
fun main() {val names = listOf("Alex", "Bob", "Celina")for (i in 0 until names.size) {val name = names[i]println("[$i] $name")}}// [0] Alex// [1] Bob// [2] Celina
...