Kotlin/Collections
Kotlin list for문 - index loop
1. For loop Kotlin에서 for문은 기본적으로 Java의 향상된 for문 처럼 원소로 접근한다. 따라서 index로 for문을 반복하기 위해서는 List에 존재하는 indices 프로퍼티를 사용하거나 forEachIndexed 사용할 수 있다. 2. 코 드 환경 : Kotlin Version = 1.4.10, JVM fun main(args : Array) { val ml = mutableListOf(1, 2, 3, 4, 5) // 리스트 출력 print("1. ") println(ml) // 각 원소 for문 print("2. ") for(a in ml) { print("$a ") } println() // index로 for문 print("3. ") for(i in 0..ml.lastIn..