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

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

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

2.63 OTHERWISE Statement<br />

OTHERWISE<br />

The OTHERWISE statement is used in conjunction with the SELECT statement. The OTHERWISE<br />

statement marks the start of a new CASE block which is a series of zero or more statements ending in an<br />

END SELECT statement.<br />

When this statement is used and the value of a case expression is not found in any case list then control of<br />

execution is transferred to the first executable statement following the OTHERWISE statement.<br />

The CASE DEFAULT statement may be used in place of the OTHERWISE statement.<br />

Example:<br />

SELECT CASE ( CH )<br />

CASE ( ’a’ : ’z’ )<br />

PRINT *, ’Lower case letter’<br />

CASE ( ’A’ : ’Z’ )<br />

PRINT *, ’Upper case letter’<br />

CASE ( ’0’ : ’9’ )<br />

PRINT *, ’Digit’<br />

OTHERWISE<br />

PRINT *, ’Special character’<br />

END SELECT<br />

In the above example, if the character CH is not a letter or digit then the OTHERWISE block is executed.<br />

Note:<br />

The OTHERWISE or CASE DEFAULT block must follow all other CASE blocks.<br />

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

OTHERWISE Statement 115

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

Saved successfully!

Ooh no, something went wrong!