add values to array kotlin code example
Example 1: kotlin add element to array
val list: MutableList<String> = ArrayList()
list.add(3, "Hello")
// Adds Hello as the third item in list
list.add("Goodbye")
// Adds Goodbye to the end of list
Example 2: kotlin array
val a: Array<Double> = arrayOf(3.0, 4.5, 8.0, 19.0)
Example 3: kotlin size of array
arr = arrayOf(10, 20, 30, 40, 50)
// Use the size attribute
println(arr.size)
Example 4: add to array kotlin
var listofVehicleNames = arrayListOf("list items here")