Consider the following object,
object A { def setX(x:Int) = { val x1 = x } def getx() = x1 }
If I create val x1 inside setX, then the scope will be the setX method. what I really want to do is create a val outside the method and assign a value inside the method . Is this impossible without using var, or is there any way to do this?
Send me an example if you can.
tiran source share