Basic HTML version of Foils prepared
Sept 20 97
Foil 28 Control Structures -- for Statement
From
Tutorial on PERL Computational Science for Information Age Course CPS616 --
Sept 20 97
.
by
Geoffrey C. Fox,Nancy McCracken,Tom Scavo
1
for ( beginning expression; endtest; doeachloop ) {
FOR statement-block;
2
}
3
The above loop is just like C and equivalent to:
4
beginning-expression;
5
while ( endtest ) {
FOR statement-block;
doeachloop;
6
}
7
For example, we can print the digits with:
8
for ( $i=0; $i <10; $i++ ) {
print "$i", "\n";
9
}
in Table To:
©
Northeast Parallel Architectures Center, Syracuse University, npac@npac.syr.edu
If you have any comments about this server, send e-mail to
webmaster@npac.syr.edu
.
Page produced by
wwwfoil
on Sun Sep 21 1997