Create an array using a closure
suggest changeval a = Array(3) { i -> i * 2 } // creates an Array<Int> of size 3 containing [0, 2, 4]
Found a mistake? Have a question or improvement idea?
Let me know.
Table Of Contents
val a = Array(3) { i -> i * 2 } // creates an Array<Int> of size 3 containing [0, 2, 4]