O'Reilly logo

Swift Programming: The Big Nerd Ranch Guide by John Gallagher, Matthew Mathias

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required