If statements inside or outside loops?
Posted
by Timmy
on Stack Overflow
See other posts from Stack Overflow
or by Timmy
Published on 2010-02-11T04:18:09Z
Indexed on
2010/05/25
4:31 UTC
Read the original article
Hit count: 175
perl
|optimization
Is it better if I do this:
foreach my $item ( @array ) {
if ( $bool ) {
.. code ..
}
else {
.. code ..
}
}
or
if ( $bool ) {
foreach my $item ( @array ) {
}
}
else {
foreach my $item ( @array ) {
}
}
© Stack Overflow or respective owner