I'd like to clarify some details about Unit and Nothing.
For example:
def unit(companyId: Int): Unit = {}
def Nothing(companyId: Int): scala.Nothing = {}
According to the docs, Unit in Scala is very similar to void in Java. But
test("test Unit and Nothing") {
println(unit(1))
}
Unitreturn -()Nothingdoes not return anything.
Why does Scala has overflow type Unit which return Nothing?
Why Scala cannot useNothing instead of Unit?