develooper Front page | perl.perl6.language | Postings from December 2004

Re: while Idiom (Was: Arglist I/O)

From:
Luke Palmer
Date:
December 6, 2004 10:41
Subject:
Re: while Idiom (Was: Arglist I/O)
Message ID:
20041206184115.GC1293@navi.cx
Smylers writes:
> To me C<for> makes sense when you've got a pile of stuff you're
> intending to process (such as array items or lines in a file), and
> C<while> makes sense when you're waiting for a condition (such as the
> user correctly entering her/his password) and you couldn't possibly know
> in advance how many times you'll be looping.

And iterating over lines in a file is kind of between the two.  Since
both while and for work just as efficiently, and they're both just as
clear (we see that Austin thinks while is clearer than for, and I think
the opposite), I think it's great that you can use both.

Luke



nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About