I am working with this code.
fun main(args : Array<String>){
val someArray : Array<Int> = arrayOf(3,53,2,521,51,23,512,34,124);
println("Original array is ")
someArray.forEach {print("$it , ")}
someArray.map({num -> num*2})
println("Changed array is ")
println()
someArray.forEach { print("$it , ") }
}
But the map function does not seem to work. Here is what it prints
Original array is 3 , 53 , 2 , 521 , 51 , 23 , 512 , 34 , 124 , Changed array is
3 , 53 , 2 , 521 , 51 , 23 , 512 , 34 , 124 ,
My question is why is the array not doubling the value of its elements? What i am i missing here?