in reply to Re: Re: Re: for loop localisation bug?
in thread for loop localisation bug?

Well, depending on the rest of the code, and the sophistication of the compiler one could postulate reasonably that it might be optimised to

print 5;

As for Turing you would say (and I forget most of my turing so ill write in Perl as if it were Turing)

my $value; for $i (0..10) { if ($i==5) { $value=$i; last; } } print $value;

Actually thats much the same as what you need to do in Perl anyway (if you are interested in the value of the iterator afterwards.) IMo, its arguable that you would be better served by a while loop anyway, at least thats what I usually do in this type of scenario.

Oh, Happy New Year mate. :-)


---
demerphq

    First they ignore you, then they laugh at you, then they fight you, then you win.
    -- Gandhi