Skip to Main Content
Swift for Beginners: Develop and Design, Second Edition
book

Swift for Beginners: Develop and Design, Second Edition

by Boisy G. Pitre
December 2015
Beginner content levelBeginner
336 pages
9h 13m
English
Peachpit Press
Content preview from Swift for Beginners: Develop and Design, Second Edition

Chapter 4. Writing Functions and Closures

I’ve covered a lot up to this point in the book: variables, constants, dictionaries, arrays, looping constructs, control structures, and the like. You’ve used both the REPL command-line interface and now Xcode’s playgrounds feature to type in code samples and explore the language.

Up to this point, however, you have been limited to mostly experimentation: typing a line or three here and there and observing the results. Now it’s time to get more organized with your code. In this chapter, you’ll learn how to tidy up your Swift code into nice clean reusable components known as functions.

Let’s start this chapter with a fresh new playground file. If you haven’t already done so, launch Xcode and create a new ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Swift for Beginners: Develop and Design

Swift for Beginners: Develop and Design

Boisy G. Pitre
Swift For Dummies

Swift For Dummies

Jesse Feiler

Publisher Resources

ISBN: 9780134289793Purchase book