Why after updating Array element I still get old array values?

Sebastian M Cheung <[email protected]>
Newsgroups gmane.comp.lang.scala
Message-ID <[email protected]>

Why after updating Array element I still get old array values?



var compactWay = Array("I", "like", "this", "way")

>compactWay: Array[String] = Array(I, like, this, way)


compactWay(0) = "We"

println(compactWay.mkString(" "))

>We like this way res3: Unit = ()


var secondList = Array("Something else")

var thirdList = compactWay++secondList

>thirdList: Array[String] = Array(I, like, this, way, Something else)

(expecting to see Array(We, like, this, way, Something else)


-- 
You received this message because you are subscribed to the Google Groups "scala-language" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
For more options, visit https://groups.google.com/d/optout.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.