How to make such an assignment possible. = returns unit.

    2 answers 2

    val x, y = 1 

    Conclusion:

     >>x: Int = 1 >>y: Int = 1 

      In fact, x is Unit in this case ::

       var y = 2 var x = y = 1 

      Can be read as:

       var y = 2 var x = (y = 1) 

      and finally:

       var x: Unit = () 

      You can go to type x = y = 1 in the REPL shell without errors:

       var x:Unit = {} var y = 0 x = y = 1