Perl last statement


Release date:2023-10-17 Update date:2023-10-21 Editor:admin View counts:332

Label:

Perl last statement

Perl last statement is used to exit the loop statement block, thus ending the loop last the statement after the statement is no longer executed continue statement blocks are no longer executed.

Grammar

The syntax format is as follows:

last [LABEL];

Flow chart

Image0

Example

#!/usr/bin/perl$a=10;while($a<20){if($a==15){#
exit a loop $a=$a+1;last;}print"The value of a is:$a\\n";$a=$a+1;}

Execute the above program, and the output is as follows:

The value of a is: 10
The value of a is: 11
The value of a is: 12
The value of a is: 13
The value of a is: 14

Powered by TorCMS (https://github.com/bukun/TorCMS).