programming-examples/perl/Statement/The for Loop.pl

15 lines
335 B
Perl
Raw Normal View History

2019-11-15 12:59:38 +01:00
#Format: for (Expression1;Expression2;Expression3) {Block}
#The above format is equivalent to the following while statement:
#Expression1;
#while (Expression2)
# {Block; Expression3};
#!/usr/bin/perl
for ($i=0; $i<10; $i++){ # Initialize, test, and increment $i
print "$i ";
}
print "\nOut of the loop.\n";