Kotlin Arrays Create an array using a closure


Example

val a = Array(3) { i -> i * 2 } // creates an Array<Int> of size 3 containing [0, 2, 4]