3: Loops
( \newcommand{\kernel}{\mathrm{null}\,}\)
The programs we have seen so far are straight-line code; that is, they execute one instruction after another from top to bottom. This chapter introduces one of the most important programming-language features, the for
loop, which allows simple programs to perform complex, repetitive tasks. This chapter also introduces the mathematical concepts of sequence and series, and a process for writing programs, incremental development.