in reply to Inverted logic
A will print at the end of the loop if all of the modulo tests come out true.
B will print every time one of the modulo tests come out true during the loop.
What you want is more like:
print "\nLoop 2"; B: for my $a ( 0 .. 9 ) { for my $b ( 2..4 ) { unless( $a % $b ) { next B; } } print $a; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Inverted logic
by McA (Priest) on Jul 24, 2013 at 15:27 UTC | |
by SuicideJunkie (Vicar) on Jul 24, 2013 at 15:48 UTC |