Search results for "module:Perl::Critic::Policy::ControlStructures::ProhibitCStyleForLoops"

Perl::Critic::Policy::ControlStructures::ProhibitCStyleForLoops - Write for(0..20) instead of for($i=0; $i<=20; $i++). River stage three • 131 direct dependents • 386 total dependents

The 3-part "for" loop that Perl inherits from C is butt-ugly, and only really necessary if you need irregular counting. The very Perlish ".." operator is much more elegant and readable. for($i=0; $i<=$max; $i++){ #ick! do_something($i); } for(0..$max...

PETDANCE/Perl-Critic-1.142 - 29 Nov 2022 02:20:23 UTC
1 result (0.068 seconds)