Skip to content

Control Flow ​

At its heart, a program is just "do different things depending on the conditions" plus "do the same thing over and over." In this chapter we walk through every piece of syntax C++ gives you for steering the flow of execution — starting from the most basic if/else, moving through the various loops, and finishing with the range-based for introduced in C++11. You'll find that range-for feels far nicer to write than the traditional for(int i=0; ...), and we'll be leaning on it heavily from here on out.

Chapter Contents ​

pdf-latest-4-g85128cc · 85128cc · 2026-10-05