Conditional Control Flow

Discover how to write Swift control flow logic to decide which lines of code should be executed and which should not. In addition, practice using the conditional control flow constructs provided by Swift.

In a previous lesson, we looked at how to use logical expressions in Swift to determine whether something is true or false. Since programming is largely an exercise in applying logic, much of the art of programming involves writing code that makes decisions based on one or more criteria. Such decisions define which code gets executed and, conversely, which code gets by-passed when the program is executing.

Get hands-on with 1200+ tech skills courses.