Code to print both index numbers and values in Kotlin? All Questions › Category: Kotlin › Code to print both index numbers and values in Kotlin? 0 Vote Up Vote Down chetan shidling asked 4 years ago I need short information. 1 Answers 0 Vote Up Vote Down chetan shidling answered 4 years ago Here is the code to print both index numbers and values in Kotlin. fun main(args : Array<String>){var nums = listOf(1,2,3,4) for((i,e) in nums.withIndex()){println(” $i : $e”)}} Output: 0 : 1 1 : 2 2 : 3 3 : 4