“Perl faire en boucle” Réponses codées

Perl faire en boucle

# Basic syntax:
do {
   code to run;
} while( condition );

# Example usage:
$i = 5;
do {
   print "Value of i: $i\n";
   $i += 1;
} while( $i < 10 );
# Note, do..while loops are very similar to while loops except that they
#	always execute at least once
Charles-Alexandre Roy

Perl jusqu'à la boucle

# Basic syntax:
until( condition ) {
   code to run;
}

# Example usage:
$i = 5;
until( $i > 10 ) {
   print "Value of i: $i\n";
   $i += 1;
}
# Note, until loops are kind of the opposite of whiles loop, they loops over 
# 	the code until the condition becomes true
Charles-Alexandre Roy

Perl en boucle

# Basic syntax:
while( condition ) {
   code to run;
}

# Example usage:
my $i = 5;
while( $i < 10 ) {
   print "Value of i: $i\n";
   $i += 1;
}
Charles-Alexandre Roy

Réponses similaires à “Perl faire en boucle”

Questions similaires à “Perl faire en boucle”

Parcourir les réponses de code populaires par langue

Parcourir d'autres langages de code