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
Share this Page URL
Help

Chapter 18. Advanced Types > Singleton Types

18.1. Singleton Types

Given any value v, you can form the type v.type, which has two values: v and null. This sounds like a curious type, but it has a couple of useful applications.

First, consider a method that returns this so you can chain method calls:


  

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