Possible Duplicate:
++ operator in Scala
I want to increment an Int variable in scala. But, because Int is immutable, I have to do this
var myInt: Int = 5 .... myInt = myInt + 1 which seems a little too complicated. What I would like to do is
var myInt: Int = 5 .... myInt++ however, since Int is immutable, I can't do this. Is there any solution? Because I can't be first who would want to use ++ on integer variable...
def inc(i:Int) = i+1