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 2. Control Structures and Functions > Default and Named Arguments L1

2.8. Default and Named Arguments L1

You can provide default arguments for functions that are used when you don’t specify explicit values. For example,

def decorate(str: String, left: String = "[", right: String = "]") =
  left + str + right


  

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