Chapter 11. Collections

This chapter covers

  • Arrays
  • The for statement and loop
  • Dictionaries
  • Creating a state-name lookup app

Almost every app you’ll ever write will need some way to store data. You already learned about storing data in variables in chapter 8, but sometimes you need to store several pieces of data together in a grouping of some sort. This is where the idea of collections comes in—a collection of values that can be stored together. Imagine if you went to the grocery store and had to buy one egg at a time instead of a nice dozen packaged together. It would be a bit annoying, for sure. This chapter covers two different collection types (egg cartons) to store your data.

11.1. Quantum arrays: not really, but that sounds **br/** ...

Get Anyone Can Create an App: Beginning iPhone and iPad programming now with the O’Reilly learning platform.

O’Reilly members experience live online training, plus books, videos, and digital content from nearly 200 publishers.