02.07.2013 Views

HP Fortran Programmer's Reference

HP Fortran Programmer's Reference

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

END<br />

Marks the end of a program unit or procedure.<br />

Syntax<br />

END [keyword [name]]<br />

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

END<br />

keyword is one of the keywords BLOCK DATA, FUNCTION, MODULE, PROGRAM, or<br />

SUBROUTINE. WhentheEND statement is used for an internal procedure or<br />

module procedure, the FUNCTION or SUBROUTINE keyword is required.<br />

name is the name given to the program unit. If name is specified, keyword must<br />

also be specified.<br />

Description<br />

The END statement is the last statement of a program unit (that is, a main program, function,<br />

subroutine, module, or block data subprogram), an internal procedure, or a module procedure.<br />

It is the only statement that is required within a program unit.<br />

Examples<br />

The following example illustrates the use of the END statement to indicate the end of a main<br />

program. Notice that, even though the main program unit is given a name, the END PROGRAM<br />

statement does not require it:<br />

PROGRAM main_prog<br />

...<br />

END PROGRAM<br />

In the next example, the END statement marks the end of an internal function and must<br />

therefore specify the keyword FUNCTION. However, it is not required that the name, get_args,<br />

be also specified:<br />

FUNCTION get_args (arg1, arg2)<br />

...<br />

END FUNCTION get_args<br />

ThefollowingexampleusestheEND statement to indicate the end of a block data subprogram.<br />

Because the END statement specifies the program unit name, it must also specify the keyword<br />

BLOCK DATA:<br />

BLOCK DATA main_data<br />

...<br />

END BLOCK DATA main_data<br />

Chapter 10 307

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

Saved successfully!

Ooh no, something went wrong!