7.1. Integrating Concepts

By now you have learned about five of the basic building blocks of programming:

That’s a lot! Stop for a moment and congratulate yourself on getting this far! We are going to take a breather now, and not introduce any new concepts. In this chapter you will see examples of how to combine functions, iteration, and conditionals together to solve problems. You’ll also get some hints on how to know which one of these concepts to apply in which circumstances.

We’ll also try to visualize how these things combine using some color-coded diagrams. We’ll represent functions as blue blocks, for loops as pink blocks and conditional statements as green blocks.

7.1.1. Topics

  • When to use iteration vs. functions for code re-use

  • How to combine iteration and functions

  • How to combine iteration and conditionals

  • How to combine functions and conditionals

  • How to combine all three!

You have attempted of activities on this page