Chapter 4. Control Structures
Working with data is difficult if you have to do it in a completely linear manner, which makes control structures a vital part of any programming language. On the surface, the control structures in Swift are the same as those in Objective-C, but once you start to dig a little deeper you will begin to find that they go beyond what was possible before in a number of ways.
General Changes
Like Objective-C, Swift has four main control structures:
for
and for-in
loops
while
and do-while
loops
if
conditional blocks
Get Swift Translation Guide for Objective-C Users: Develop and Design now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.