Programming-Idioms

History of Idiom 43 > diff from v4 to v5

Edit summary for version 5 :

Version 4

2015-07-31, 19:50:58

Version 5

2015-07-31, 19:51:07

Idiom #43 Break outer loop

Look for a negative value v in 2D integer matrix m. Print it and stop searching.

Idiom #43 Break outer loop

Look for a negative value v in 2D integer matrix m. Print it and stop searching.

Code
OUTER:
for my $i (0 .. $#m) {
   for $j (0 .. $#{$m[$i]}) {
      if ($m[$i][$j] == $v) {
         print "$v\n";
         last OUTER;
      }
      }
}
Code
OUTER:
for my $i (0 .. $#m) {
   for $j (0 .. $#{$m[$i]}) {
      if ($m[$i][$j] == $v) {
         print "$v\n";
         last OUTER;
      }
   }
}