programming-examples/perl/Statement/Using the redo statement in a while structure.pl

12 lines
242 B
Perl
Raw Normal View History

2019-11-15 12:59:38 +01:00
$number = 1;
while ( $number <= 5 ) {
if ( $number <= 10 ) {
print "$number ";
++$number;
redo; # Continue loop without testing ( $number <= 5 )
}
}
print "\nStopped when \$number became $number.\n";