Example using the continue block : continue « Statement « Perl






Example using the continue block


#! /usr/bin/perl#

for ($i=1; $i<=10; $i++) {     
     if ($i==5){
        print "\$i == $i\n";
        next;
     }
     print "$i ";
}

 








Related examples in the same category

1.The continue block gets executed just before the condition gets evaluated again
2.The continue block allows the while loop to act like a for loop