02.07.2013 Views

HP Fortran Programmer's Reference

HP Fortran Programmer's Reference

HP Fortran Programmer's 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.

SUBROUTINE altitude (*, long, lat)<br />

! asterisk (*) indicates alternate return<br />

IMPLICIT NONE<br />

INTEGER, OPTIONAL :: long, lat<br />

RETURN 1<br />

END SUBROUTINE altitude<br />

<strong>HP</strong> <strong>Fortran</strong> statements<br />

SUBROUTINE<br />

The preceding subroutines may be referenced with the CALL statement, as in the following<br />

program:<br />

PROGRAM reject<br />

CALL exchange (a,t) ! A subroutine reference<br />

! subroutine reference, including an alternate return label,<br />

! missing optional argument, and an argument keyword<br />

CALL altitude (*90, lat = 49)<br />

END PROGRAM reject<br />

Following are some other examples of subroutine statements:<br />

SUBROUTINE pressure_surface ! No arguments<br />

SUBROUTINE taffy () ! Also no arguments<br />

RECURSIVE SUBROUTINE fact (n, x)<br />

Related statements<br />

CALL, END, ENTRY, FUNCTION, andRETURN<br />

Related concepts<br />

For related information, see the following:<br />

“External procedures” on page 129<br />

“Arguments” on page 139<br />

Chapter 10 441

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

Saved successfully!

Ooh no, something went wrong!