docs.scala-lang icon indicating copy to clipboard operation
docs.scala-lang copied to clipboard

Unit used in Scala Book without an explanation

Open marksmithson opened this issue 3 years ago • 0 comments

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.

marksmithson avatar Dec 01 '21 11:12 marksmithson