This is the same as this loop:
for (int i = 0; i != 10; i++) { Console.WriteLine(i); }
In addition, the variable i declared outside the loop, so the scale is larger.
In the for loop, the first parameter is initialization, the second is a condition, and the third is an increment (in fact, it can be anything). The book shows how initialization and increment are moved to the place in the code where they are actually executed. The loop can also be shown as an equivalent while :
int i = 0; while (i != 10) { Console.WriteLine(i); i++; }
Here the variable i also declared outside the loop, so the scope is larger.
Guffa
source share