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 14. Pattern Matching and Case Classes > Infix Notation in case Clauses

14.11. Infix Notation in case Clauses

When an unapply method yields a pair, you can use infix notation in the case clause. In particular, you can use infix notation with a case class that has two parameters. For example:

amt match { case a Currency u => ... } // Same as case Currency(a, u)


  

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