list length kotlin

// Step 1: Create a list of elements
val myList = listOf(1, 2, 3, 4, 5)

// Step 2: Use the size property to get the length of the list
val lengthOfList = myList.size

// Step 3: Print the length of the list
println("Length of the list: $lengthOfList")