To instantiate the variables can do so:
scala> var (a, b, c) = (0, 0, 23)
a: Int = 0
b: Int = 0
c: Int = 23
but if I wanted to do such a thing?
scala> a = b = c
<console>:10: error: type mismatch;
found : Unit
required: Int
a = b = c
^
how can I do?
Thanks
You can't do
a = b = cbecauseahas already been defined as aInt var, and with thea = b = cstatement you are givingaaUnit, 'b = c'.When you assign a value to a variable in Scala you don't get as a result the value assigned.
In other languages
b = cwould be evaluated to 23, the value of c. In Scalab = cis just aUnit, writinga = b = cis exactly like writinga = (b = c), hence the error.