docs.scala-lang
docs.scala-lang copied to clipboard
Unit used in Scala Book without an explanation
In the Scala book, Unit
is used in the Sample Pizza class example on this page https://docs.scala-lang.org/overviews/scala-book/enumerations-pizza-class.html.
This has not previously been explained. Perhaps it could be described on the previous page in the section about method return types. https://docs.scala-lang.org/overviews/scala-book/methods-first-look.html
I looked it up and found this - https://www.scala-lang.org/api/2.13.3/scala/Unit.html. I "think" it means that the return type is equivalent to a Javascript void
.