O'Reilly logo

Swift OS X Programming for Absolute Beginners by Wallace Wang

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

Chapter    10

Tuples, Sets, and Structures

Variables are good for storing individual chunks of data while arrays and dictionaries are good for storing lists of the same data type. For greater flexibility, Swift also offers additional data structures called tuples and sets.

A tuple lets you store related data in one place that may consist of different data types such as a string and an integer, which could represent a person’s name and an employee ID number. A set is similar to an array or a dictionary in letting you store two or more chunks of data that consists of the same data type, such as strings or integers.

To group related data together, Swift also offers structures. With a structure, you can define the data type you want to group together ...

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