Basic HTML version of Foils prepared March 30 97

Foil 27 Control Structures -- for Statement (Chapter 4 of the Llama Book)

From PERL4 Tutorial for CPS616 Computational Science for Information Age Course CPS616 -- February 1995. by Geoffrey C. Fox


1 for ( beginning expression; endtest; doeachloop ) {
  • FOR statement-block;
  • }
2 is just like C and equivalent to:
3 beginning-expression;
4 while ( endtest) {
  • FOR statement-block;
  • doeachloop;
  • }
5 For example, we can print the numbers 1 through 10 with:
6 for ($index=1; $index <=10; $index++ ) {
  • print $index,"\n";
  • }

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 Sat Sep 6 1997