Search
 
SCRIPT & CODE EXAMPLE
 

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;
    }
}
Comment

perl exit loop example

my $counter = 1;
foreach $foo (sort {$importHash{$b} <=> $importHash{$a}} (keys %importHash))
{
  # push the string $foo onto the @tags array
  push @tags, $foo;
  
  # break out of our perl loop when the counter reaches 10
  last if ($counter++ == 10);
}
Comment

PREVIOUS NEXT
Code Example
Perl :: Perl (perl 2018.12) sample 
Perl :: how to initialize an array 
Pascal :: pascal pause 
Pascal :: exceptions in pascal 
Pascal :: pascal iteration 
Pascal :: pascal 
Powershell :: disable defender powershell 
Powershell :: Saved Windows Credentials 
Gdscript :: godot check if object is in group 
Gdscript :: gdscript variables 
Clojure :: clojure write file 
Lisp :: list contains lisp 
Assembly :: json vulnerabilities 
Assembly :: resize pdf file 
Assembly :: scanf prototype in c 
Assembly :: get public ssh key 
Javascript :: jquery vslidation remove spaces from input 
Javascript :: map range of numbers to another range 
Javascript :: jest cache clear 
Javascript :: javascript replace spaces with dashes 
Javascript :: import redux thunk 
Javascript :: jquery refresh page 
Javascript :: delete session javascript 
Javascript :: get week day name in javascript 
Javascript :: how to remove checked attribute of checkbox in jquery 
Javascript :: loop array backwards javascript 
Javascript :: generate random whole numbers within a range javascript 
Javascript :: jquery remove and add class 
Javascript :: how to use another port in angular 
Javascript :: How to get current URL with Javascript or React 
ADD CONTENT
Topic
Content
Source link
Name
6+5 =