On Oct 10, 12:59 am, shlo...@iglu.org.il (Shlomi Fish) wrote:
> On Sunday 10 October 2010 03:09:21 Ron Bergin wrote:
>
>
>
> > On Oct 7, 3:07 pm, shlo...@iglu.org.il (Shlomi Fish) wrote:
> > > Hi all,
>
> > > after being tired of telling Perl newcomers about the same problems with
> > > their code times and times again, I've decided to create this page
> > > detailing "Perl Elements to avoid":
>
> > >http://perl-begin.org/tutorials/bad-elements/
>
> > [quote]
> > C-style for loops
>
> > Some beginners to Perl tend to use C-style-for-loops to loop over an
> > array's elements:
> > [/quote]
>
> > Have you considered including an example were it would be appropriate
> > to use the C-style for loop, such as when the iterator needs to change
> > by some value other than 1?
>
> Well, in this case, PBP recommends to use a while/continue loop:
>
This is one area where I disagree with PBP, at least in most cases.

The  while/continue loop is more verbose and to the beginner more
difficult to understand.

>
> But it's a good idea to show both versions. Thanks!

I would agree that showing both versions would be best.


--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to