Is this value assigned to a variable? If this is the case, I think the sugar syntax:
scala> var x = IndexedSeq(1,2,3) x: IndexedSeq[Int] = Vector(1, 2, 3) scala> x :+= 10 scala> x res59: IndexedSeq[Int] = Vector(1, 2, 3, 10) scala> val y = IndexedSeq(1,2,3) y: IndexedSeq[Int] = Vector(1, 2, 3) scala> y :+= 10 <console>:16: error: value :+= is not a member of IndexedSeq[Int] y :+= 10 ^ ) scala> var x = IndexedSeq(1,2,3) x: IndexedSeq[Int] = Vector(1, 2, 3) scala> x :+= 10 scala> x res59: IndexedSeq[Int] = Vector(1, 2, 3, 10) scala> val y = IndexedSeq(1,2,3) y: IndexedSeq[Int] = Vector(1, 2, 3) scala> y :+= 10 <console>:16: error: value :+= is not a member of IndexedSeq[Int] y :+= 10 ^ ) scala> var x = IndexedSeq(1,2,3) x: IndexedSeq[Int] = Vector(1, 2, 3) scala> x :+= 10 scala> x res59: IndexedSeq[Int] = Vector(1, 2, 3, 10) scala> val y = IndexedSeq(1,2,3) y: IndexedSeq[Int] = Vector(1, 2, 3) scala> y :+= 10 <console>:16: error: value :+= is not a member of IndexedSeq[Int] y :+= 10 ^
This syntactic sugar for the "operation and use", such as += :
scala> var x = 10 x: Int = 10 scala> x += 1 scala> x res63: Int = 11
What are de-sugars for x = x + 1 .
pedrofurla
source share