Controlling Program Flow
Although there can be a multitude of ways in which to control program flow in code, often the best approach balances succinctness and readability with performance.
In this chapter, the similarities and differences of each control flow construct in Objective-C and Swift will be examined, and entirely new capabilities in Swift will be introduced.
Let’s begin by covering two new Swift mechanisms for creating representations of iterable sequences that can be used in control flow statements: range operators and stride() functions.
Objective-C includes NSRange, which is a struct representing the location and length index of a series of values. Although it can be used outright to iterate over a range ...