For Statement in Perl - Perl Views : 261
Tagged in : Perl
0 0
Send mail

For Statement in Perl


The for statement performs a loop as long as a a tested expression is true, increasing the value for each loop.

for ( initial_expression; test_expression; increment_expression ) {
statement1;
statement2;
}

The following example prints the numbers 1 to 10.

for ($i = 1; $i <=10; $i++) {
print "$i ";
}

By Geethalakshmi, On - 2010-09-17



    Login to add Comments .