Say I have an Array[Int] like
Array[Int]
val array = Array( 1, 2, 3 )
Now I would like to append an element to the array, say the value
You can use :+ to append element to array and +: to prepend it:
:+
+:
0 +: array :+ 4
should produce:
res3: Array[Int] = Array(0, 1, 2, 3, 4)
It's the same as with any other implementation of Seq.
Seq