Iteration
nExemplified by C-style for loop:
n#define SIZE 100
nint array[SIZE];
nint sum=0;
nfor (i=0;i<SIZE;i++)
n    sum+=array[i];
nIncluded in object-oriented languages:
n// Java stolen from William Mitchell
ndouble sum=0.0;
nfor (int i=0;i<sensors.length;i++)
n    sum+=sensors[i].getTemperature();
Probably everyone who knows a C-style language will recognize the “for” statement here as an example of iteration.  It has been with us since the 70s or before.  It is used so often that other loops like “while” and “do while” are rare.  If you use BASIC, there you will have “for i=1 to SIZE” and a “next.”

Object-oriented languages, especially C++, have kept this syntax in part for backward compatibility.  Java made an improvement in that arrays are aware of their length, but did not go much beyond that.  In many cases it is easier for the programmer to stick to the procedural recipe than to improve on it.  Let’s see what kinds of potential problems this can cause.