Expand description
The ()
type, also called “unit”.
The ()
type has exactly one value ()
, and is used when there
is no other meaningful value that could be returned. ()
is most
commonly seen implicitly: functions without a -> ...
implicitly
have return type ()
, that is, these are equivalent:
The semicolon ;
can be used to discard the result of an
expression at the end of a block, making the expression (and thus
the block) evaluate to ()
. For example,