scala unit

A result type of Unit indicates the function returns no interesting
value. Scala’s Unit type is similar to Java’s void type, and in fact every
void-returning method in Java is mapped to a Unit-returning method in
Scala.

Methods with the result type of Unit, therefore, are only executed for
their side effects.

你可能感兴趣的:(scala)