Kotlin Program to Print an Array

Kotlin Program to Print an Array. In this tutorial, we’ll look into Kotlin array. If you’re new to Kotlin, it’s recommended to go through the Introduction to Kotlin tutorial to ensure that you’re up to speed with this tutorial.

Kotlin Program to Print an Array

Source Code

fun main(args: Array<String>) {
    val array = intArrayOf(1, 2, 3, 4, 5,6,7)

    for (element in array) {
        println(element)
    }
}

Output