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.16 CYCLE Statement<br />

CYCLE<br />

[: block-label]<br />

The CYCLE statement may be used to cause a transfer of control from within a loop to the terminal<br />

statement of a corresponding DO, DO WHILE, WHILE or LOOP statement. If block-label is present<br />

then control is transferred to the terminal statement of the block identified by that block label. The CYCLE<br />

statement is an extension to the <strong>FORTRAN</strong> <strong>77</strong> language.<br />

Example:<br />

LOOP<br />

WRITE( UNIT=*, FMT=’(A)’ ) ’Enter a number’<br />

READ( UNIT=*, FMT=’(F10.4)’, IOSTAT=IOS ) X<br />

IF( IOS .NE. 0 ) CYCLE<br />

IF( X .LT. 0 ) EXIT<br />

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

END LOOP<br />

END<br />

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

CYCLE Statement 37

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

Saved successfully!

Ooh no, something went wrong!