WHAT YOU WILL LEARN IN THIS CHAPTER:
One of the most important aspects of a programming language is its ability to make decisions and perform repetitive tasks. In this aspect, Swift provides the usual flow control statements for making decisions through the use of the If-Else statement. For making multiple comparisons, Swift provides the Switch statement, which in addition to being similar to its counterpart in C, is much more powerful and flexible.
Swift also supports the C-style For and While loops and introduces the new For-In loop to iterate through arrays, dictionaries, and strings.
Swift primarily provides two types of statements for flow control: the If statement and the Switch statement.
If you have programmed before, you are familiar with the If statement. The If statement enables you to make a decision based on a certain condition(s). ...