Section 7.1 Integrating Concepts
Subsection 7.1.1
By now you have learned about five of the basic building blocks of programming:
- how to store information in variables
- how to process information using math, logic and other operators
- how to modularize programs so that instructions for a specific task are separated into functions
- how to iterate over collections of data (strings of characters, lists of values) using for loops
- how to control the path of execution using conditional statements
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.
Subsection 7.1.2 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.