O'Reilly logo

Mastering Swift 4 - Fourth Edition by Jon Hoffman

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Control flow

Control flow, also known as flow of control, refers to the order in which statements, instructions, or functions are executed within an application. Swift supports most of the familiar control flow statements that are used in C-like languages. These include loops (including while), conditional statements (including if, switch, and guard), and the transfer of control statements (including break and continue). It is worth noting that Swift does not include the traditional C for loop and, rather than the traditional do-while loop, Swift has the repeat-while loop.

In addition to the standard C control flow statements, Swift has also included statements such as the for-in loop and enhanced some of the existing statements, such as ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required