Arrays in Kotlin

I am learning about Kotlin and I am facing this code:

val list = 1.rangeTo(18).toList() // output numbers 1 to 18 val arr = IntArray(18) { it } // output numbers 0 to 17

Considering these options, in order to apply good practices, which one should be preferable to use?

submitted by /u/General_Iroh_0817
[link] [comments]