English is not my first language, but since the keywords in programming languages are English words, I usually find it easy to read source code as English sentences:
if (x > 10) f();=> "If variable
xis greater than
10, then call function
while (i < 10) ++i;=> "While variable
iis less than
But how a
for loop is supposed to be read?
for (i = 0; i < 10; ++i) f(i);=> ???
I mean, I know what a
for loop is and how it works. My problem is only that I don't know what the English word "for" exactly means in
for each. So it would become
for each i, till i is less than 10, perform the following steps.
for each ipretty much explains everything.