I thought that Scala classifies statements as type Unit. But when I run the following code:
object HelloWorld {
var ball = new Ball
def main(args: Array[String]): Unit = {
println((ball.color = "green").getClass)
}
}
class Ball {
var color: String = "blue"
}
The output is
void
I have learned that void is only used in Scala for compatibility with Java. So why is void here used as type of this statement and not Unit?