Skip to content

Unit used in Scala Book without an explanation #2243

@marksmithson

Description

@marksmithson

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions