The "for" loop comes from ALGOL[0]. In ALGOL, the FOR statement supports syntax like "FOR V:= AEXP1, AEXP2,... DO". That's like the higher-level iterator syntax, except it's assigning V via iteration over a sequence of expressions (AEXP N) that is fixed at compile time. That's the context where FOR makes sense as a term. (Step 1: thesis)
Now, ALGOL also happens to support a FOR-STEP-WHILE format, which works the same way as the C for-loop[0]. That makes less sense from a mathematical nomenclature perspective, but it is justified through analogy to the original FOR definition.
When C, which was based in part on ALGOL, implemented for, it dropped the original meaning and kept the special case meaning because the latter was more useful, being dynamic instead of fixed at compile time. Hence, the for loop. (Step 2: antithesis)
Eventually other languages implemented for with iterators, returning to the original ALGOL meaning of for, but synthesizing it with the dynamism of the C for loop. (Step 3: synthesis)
[0] https://public.support.unisys.com/aseries/docs/clearpath-mcp...
Disclaimer: references to the Hegelian dialectic are for entertainment purposes only.
It was added in C++11 so it looks recent there. But the syntax was in Perl 4 back in 1991. And someone who knows programming history can probably find older examples still in other languages.
while guessing == true:
...
if is _correct(answer):
guessing = false // This stops execution and jumps out of the loop, right?
answer = next_guess()
...
// answer should be correct now
print('Correct answer is %s' % answer)
The program says this block of code executes "while" guessing is true. How does it make sense that code inside the loop is still executing after guessing is set to false? For you and me, since our brains have been molded to the the imperative model of programming (execute this line, then this line, then this line,) we understand that "while guessing == true:" is a line of code that only has effect at specific times, "when the program gets to it." That is not what "while" means in ordinary language, so it's confusing for a beginner until the imperative model is really locked into their heads.