programming-examples/perl/Statement/The last statement breaks out of a loop from within the loop block.pl
2019-11-15 12:59:38 +01:00

10 lines
143 B
Perl

$n=0;
while( $n < 10 ){
print $n;
if ($n == 3){
last; # Break out of loop
}
$n++;
}
print "Out of the loop.<br>";