When a program visits each element of a list of elements, programmers say the list is being traversed. Traversal is one of the most fundamental uses of iteration statements. The general loop construct for analyzing a list of data can be depicted by a flow chart or pseudocode as in Figure 9.1. Notice how the depiction matches our definition of an iteration statement presented in the beginning of the previous chapter: "An iteration statement repeats a statement or a block of statements until a given termination condition is met."
Figure 9.2 illustrates the general framework for a loop generating a list of data elements. Notice how it is merely a variation of the same theme as that shown in Figure 9.1.
There are many variations of the iteration theme, apart from the few already presented. For example, only every second element might be visited, perhaps the algorithm works faster if the list is processed from the end and backwards, or perhaps the best way is to start in the middle and work towards the beginning and end simultaneously, and so on. Fortunately, C# contains three different iteration constructs that cater to any need you might encounter. Let's have a closer look at their syntax and general form before we explore their practical use.