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>Language</strong> <strong>Reference</strong><br />

5. A name that appears as a dummy argument in an ENTRY statement must not appear in an<br />

executable statement preceding the ENTRY statement unless it has also appeared in a<br />

FUNCTION, SUBROUTINE, or ENTRY statement that precedes the executable statement.<br />

12.7 The RETURN Statement<br />

A RETURN statement is a way to terminate the execution of a function or subroutine subprogram and return<br />

control to the program unit that referenced it. As an extension to <strong>FORTRAN</strong> <strong>77</strong>, <strong>Open</strong> <strong>Watcom</strong><br />

<strong>FORTRAN</strong> <strong>77</strong> permits the use of the RETURN statement in the main program. A subprogram (or main<br />

program) may contain more than one RETURN statement or it may contain no RETURN statement. In the<br />

latter case, the END statement has the same effect as a RETURN statement.<br />

Execution of a RETURN or END statement causes all local entities to become undefined except for the<br />

following.<br />

1. Entities specified in a SAVE statement.<br />

2. Entities in blank common.<br />

3. Initially defined entities that have neither been redefined nor become undefined.<br />

4. Entities in a named common block that appears in the subprogram and in a program unit that<br />

references the subprogram directly or indirectly.<br />

12.7.1 RETURN Statement in the Main Program (Extension)<br />

The form of a RETURN statement in a main program is:<br />

RETURN<br />

When a RETURN statement is executed in the main program, program execution terminates in the same<br />

manner as the STOP or END statement. This is an extension to <strong>FORTRAN</strong> <strong>77</strong>.<br />

12.7.2 RETURN Statement in Function Subprograms<br />

The form of a RETURN statement in a function subprogram is:<br />

<br />

RETURN<br />

When a RETURN statement is executed in a function subprogram, the function value must be defined.<br />

Control is then passed back to the program unit that referenced it.<br />

276 The RETURN Statement

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

Saved successfully!

Ooh no, something went wrong!