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 />

2.73 RETURN Statement<br />

<br />

RETURN [e]<br />

where:<br />

e<br />

is an integer expression.<br />

A RETURN statement is used to terminate execution of a subprogram and return control to the program unit<br />

that referenced it. As an extension to <strong>FORTRAN</strong> <strong>77</strong>, <strong>Open</strong> <strong>Watcom</strong> <strong>FORTRAN</strong> <strong>77</strong> permits the use of the<br />

RETURN statement in the main program. When a RETURN statement is executed in the main program,<br />

program execution terminates in the same manner as the STOP or END statement.<br />

The expression e is not permitted when returning from an external function subprogram (or main program);<br />

it can only be specified when returning from a subroutine subprogram.<br />

Example:<br />

FUNCTION ABS( A )<br />

ABS = A<br />

IF( A .GE. 0 )RETURN<br />

ABS = -A<br />

RETURN<br />

END<br />

For more information, see the chapter entitled "Functions and Subroutines" on page 243.<br />

132 RETURN Statement

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

Saved successfully!

Ooh no, something went wrong!