<div dir="ltr"><div class="gmail_quote">On Thu, Mar 8, 2012 at 11:58 PM, Roman M. Parparov <span dir="ltr"><<a href="mailto:roman@parparov.com">roman@parparov.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="im">On 2/25/12 3:46 AM, sawyer x wrote:<br>
> On Fri, Feb 24, 2012 at 5:55 PM, Roman M. Parparov <<a href="mailto:roman@parparov.com">roman@parparov.com</a><br>
</div><div class="im">> <mailto:<a href="mailto:roman@parparov.com">roman@parparov.com</a>>> wrote:<br>
><br>
> And if you need steps different than one? Non-linear? :)<br>
><br>
><br>
> Relatively rare. Most uses are for single step.<br>
> If you happen to fall on a case using other steps, you would know to ignore my<br>
> warning of C-style for loops. :)<br>
><br>
><br>
</div>Recently I found another use:<br>
If I need the index value after the loop. :)<br></blockquote><div><br>Nope! :)<br><br>Writing a C-style for() loop does not give you the index value if you define it using my().<br>If you write:<br> for ( my $i = 0; $i < 10; $i++ ) {...}<br>
you will not be able to access $i afterwards, since it will only exist in the scope of the for().<br>Same as with range-style for() loop.<br><br>No reason not to move on to a more readable (and in calculated instances even FASTER) range-style for() loop instead. :)<br>
</div></div></div>