Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PERL

perl exit loop

# Basic syntax:
last;
# Where last is analogous to break in Python, Bash, R, etc

# Example usage:
for my $i (0 .. 5) {
	print "index is $i
";
    # Exit the for loop if the index equals 3
	if ($i == 3) {
		last;
    }
}
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #perl #exit #loop
ADD COMMENT
Topic
Name
1+1 =