In Scala there are no
-- operators. You should instead use the
-= operators, as shown below. First the
scala> var i = 1 i: Int = 1 scala> i++ <console>:9: error: value ++ is not a member of Int i++ ^ scala> i += 1 scala> println(i) 2
scala> i-- <console>:9: error: value -- is not a member of Int i-- ^ scala> i -= 1 scala> println(i) 1
From what I've read, there are two reasons that there are no
-- operators in Scala. First, in regards to "language purity", allowing for them would have meant adding a special rule to the language, and the language designers wanted to avoid that. Second, Scala encourages the use of immutable values, and with immutable values you'll have no need for these operators.