© Wallace Wang 2019
Wallace WangPro iPhone Development with Swift 5https://doi.org/10.1007/978-1-4842-4944-4_3

3. Understanding Closures

Wallace Wang1 
San Diego, CA, USA

Reading a single sentence isn’t difficult for most people, but when you combine thousands of sentences together, reading a long mass of text can be cumbersome. That’s why people divide large amounts of text into parts such as paragraphs and chapters. Programming is no different.

Rather than write code as one large mass of text, programmers typically divide a large program into smaller functions where each function performs a single task. Not only do functions help make a large program easier to understand, but functions also act like building blocks that you can reuse in other ...

Get Pro iPhone Development with Swift 5: Design and Manage Top Quality Apps now with O’Reilly online learning.

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