Array Equality

The next morning you wake up and go to your neighborhood coffee shop. There, you meet a friend, named Myron, who had been at the party with you. Myron was inspired by your bucketList and decided to make his own bucket list modeled after yours. He went home after the party and wrote out all of your items, and now he wants to make sure that he got everything correct.

After updating Myron with the changes you made after the party, it is time to compare your arrays of bucket list items to ensure that they are the same. Use == to check for equality.

Listing 9.15  Checking two arrays for equality

import Cocoa var bucketList = ["Climb Mt. Everest"] var newItems = [ "Fly hot air balloon to Fiji", "Watch the Lord of the ...

Get Swift Programming: The Big Nerd Ranch Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.