WHILE statement

For compatibility with FTN77, FTN95 offers an alternative WHILE statement. Its general form is

WHILE (logical expression) DO
. . . .
ENDWHILE

The WHILE-block may contain any executable Fortran statements. WHILE-blocks may be nested within each other or within IF-, ELSE-, and ELSEIF-blocks and/or DO statements. The rules of nesting are the same as those for the IF construct.

An ENDWHILE statement can be labelled but may only be referenced from within the WHILE block.

Example:

J = 0
WHILE(I.NE.0)DO
 I = LIST(I)
  J = J+1
ENDWHILE

 

 

Basket
Empty
 
Copyright © 1999-2024 Silverfrost Limited