Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.


  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • DownloadDownload
  • PrintPrint

14.16. The Option Type

The Option type in the standard library uses case classes to express values that might or might not be present. The case subclass Some wraps a value, for example Some("Fred"). The case object None indicates that there is no value.

This is less ambiguous than using an empty string and safer than using null for a missing value.


  

You are currently reading a PREVIEW of this book.

                                                                                        

Get instant access to over
$1 million worth of books and videos.

  

Start a Free Trial