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

Chapter 6. References > Item 61. Don’t confuse anonymous arrays with list liter...

Item 61. Don’t confuse anonymous arrays with list literals

The anonymous array constructor, [], looks very much like the parentheses that surround list literals. Superficially, they both seem to serve the same purpose—building lists. However, anonymous array constructors differ from list literals in significant ways.

An anonymous array constructor returns a reference, not a list. The purpose of an anonymous array constructor is to allow you to create a reference to an array object without having to create a named array:


  

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


  
  • Safari Books Online
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint