24.11.2014 Views

Open Watcom FORTRAN 77 Language Reference

Open Watcom FORTRAN 77 Language Reference

Open Watcom FORTRAN 77 Language Reference

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

<strong>FORTRAN</strong> Statements<br />

2.83 Block WHILE Statement<br />

WHILE (e) DO<br />

[: block-label]<br />

where:<br />

e<br />

is a logical expression or integer arithmetic expression, in which case the result of the integer<br />

expression is compared for inequality to the integer value 0.<br />

The block WHILE statement is used in conjunction with the structured END WHILE or UNTIL statement.<br />

The block WHILE statement marks the beginning of a sequence of statements which are to be repeated.<br />

The END WHILE or UNTIL statement marks the end of the WHILE-block. The WHILE-block is executed<br />

while the logical expression of the WHILE statement has a true value or until control is transferred out of<br />

the WHILE-block.<br />

Example:<br />

Example:<br />

X = 1.0<br />

WHILE( X .LT. 100 )DO<br />

PRINT *, X, SQRT( X )<br />

X = X + 1.0<br />

END WHILE<br />

I = 1<br />

WHILE( I .LT. 100 )DO<br />

J = 4 * I * I<br />

K = 3 * I<br />

PRINT *, ’4x**2 + 3x + 6 = ’, J + K + 6<br />

I = I + 1<br />

UNTIL( ( J + K + 6 ) .GT. 100 )<br />

END<br />

An optional block label may be specified with the WHILE statement.<br />

For more information, see the chapter entitled "Program Structure Control Statements" on page 193.<br />

Block WHILE Statement 145

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!