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 all of the familiar control flow statements that are in C-like languages. These include loops (that is,
do/while), conditional statements (that is,
switch) and the transfer of control statements (that is,
continue). In addition to the standard C control flow statements, Swift has also added additional statements, such as the
for-in loop, and has enhanced some of the existing statements, such as the
Let's begin by looking at conditional statements in Swift.
A conditional statement will check a condition ...