Control Flow
Master control flow in Swift with conditionals and loops. Learn to make decisions and iterate through data.

Join the AI Workshop to learn more about AI and how it can be applied to web development. Next cohort February 1st, 2026

The AI-first Web Development BOOTCAMP cohort starts February 24th, 2026. 10 weeks of intensive training and hands-on projects.


Control flow statements determine the order in which code is executed. They’re essential for making decisions based on conditions and repeating code multiple times.

In this unit, you’ll master control flow in Swift. We’ll cover conditionals like if-else statements and switch expressions for making decisions, as well as loops including for-in, while, and repeat-while for iterating through data. You’ll also learn about control transfer statements like break and continue.

Understanding control flow is fundamental to writing programs that respond to different conditions and process collections of data efficiently.

Lessons in this unit:

0: ▶︎ Introduction
1: If Statements
2: Switch Statements
3: Ternary Operator
4: For-In Loops
5: While Loops
6: Repeat-While Loops
7: Control Transfer Statements