How do you define a local var/val in the primary constructor in Scala?
E.g. class R(n: Int, d: Int) { val (x, y) = { val g = myfunc (n/g, d/g) } }
E.g. class R(n: Int, d: Int) { val (x, y) = { val g = myfunc (n/g, d/g) } }
bar: Int This is barely a constructor parameter. If this variable is not used anywhere except the constructor, it remains there. No field is generated. Otherwise private val bar field is created and value of bar parameter is assigned to it. No getter is created. private val bar: Int Such declaration of parameter will create … Read more