Am 13.06.2013 12:50, schrieb Kenny McCormack:
> In article <kpb4lj$5r4$
1...@speranza.aioe.org>,
> D. Aaron Sawyer <
aa...@110.net> wrote:
> ...
>> The loop variable is just another variable.
>
> Clearly so - for the "normal" (or "C-like" "for" statement). That's in the
> category of trivially obvious.
Abstracting further to other languages - Algol[68] comes to mind -, it
may be even impossible to assign to a loop variable. So, depending on
where the OP comes from, it may not be that obvious [to him].
>
> Where this question (the OP's post) becomes interesting is if you are using
> the fancy AWK-ish "for (i in A)" type "for" statement. There, the docs
> tell you that you are not supposed to change the value of the control
> variable (or add or delete elements of the array) inside the loop.
>
> What exactly happens when you do is not something I've ever had the
> inclination to test.
You'll likely get the same undefined results as with other languages
(I've tried such things with C++/STL container); infinite loops, or
access the same values on and on, etc. - Good that it's documented at
least to be undefined.
Janis