homencsa resources partnershipsoutreachsoftware_tech
alliance searchinside ncsa adv_computingsciencedivisions
left up right comment

FOR loops

The next control flow construct up the complexity line is the FOR loop. It is nearly identical to the C for loop.
 
	for ( INITIAL_EXPR ; COND_EXPR ; LOOP_EXPR ) { 
		STATEMENTS; 
	} 
The loop is initialized by evaluating INITIAL_EXPR, iterates while COND_EXPR is true, and evaluates LOOP_EXPR before beginning each subsequent loop.
 
	# an example countdown 
	for ( $i=10 ; $i>=0 ; $i-- ) { 
		print("$i\n"); 
	} 

left up right comment



NCSA
The National Center for Supercomputing Applications

University of Illinois at Urbana-Champaign

[email protected]

Last modified: June 19, 1997