In Java an array can be initialized such as:
int numbers[] = new int[] {10, 20, 30, 40, 50}
How does Kotlin\'s array initialization look li
My answer complements @maroun these are some ways to initialize an array:
Use an array
val numbers = arrayOf(1,2,3,4,5)
Use a strict array
val numbers = intArrayOf(1,2,3,4,5)
Mix types of matrices
val numbers = arrayOf(1,2,3.0,4f)
Nesting arrays
val numbersInitials = intArrayOf(1,2,3,4,5)
val numbers = arrayOf(numbersInitials, arrayOf(6,7,8,9,10))
Ability to start with dynamic code
val numbers = Array(5){ it*2}