3. Control Structures

In some of the sample programs so far, you’ve seen keywords like for and if that we haven’t explained yet. You might have gleaned some idea of their meaning already by carefully considering how they might produce the program outputs you saw. These keywords, along with while, are known as control structures, and they are present everywhere in real programs. We’ll look at their formal definitions and more examples of their use here, as they’ll let us write much more powerful, useful programs and perform more complex analyses.