I need to append strings to a Seq. I declared the Seq below with val
as the structure itself is immutable,even though I will change it by adding two elements. I read (see here) that the way to append an element to a Seq is with :+
, and the code compiles fine but it prints an empty list List()
. How to add elements to a Seq?
val bands = Seq[String]()
bands :+ "aaa"
bands :+ "bbb"
println(bands)