Assume I have a variable x which receives its value from the user at some point. Once that is done, I need to set up an Object which needs the value of x.
Naively, I'd like to write:
Object MyCoolObject(num:Double) {
//code
}
and then somewhere in the code:
val MCO = MyCoolObject(x)
But that's not possible in Scala. So how do I do it?
object.