“pętla wyjściowa perl” Kod odpowiedzi

pętla wyjściowa perl

# 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\n";
    # Exit the for loop if the index equals 3
	if ($i == 3) {
		last;
    }
}
Charles-Alexandre Roy

Przykład pętli wyjścia perla

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);
}
Vternal3

Odpowiedzi podobne do “pętla wyjściowa perl”

Pytania podobne do “pętla wyjściowa perl”

Przeglądaj popularne odpowiedzi na kod według języka

Przeglądaj inne języki kodu