OPTIONAL attribute
Standard: F77 F90 F95 F2003 F2008
Example Program
<Syntax>
type, OPTIONAL [ , attr ]... :: decl-list

OPTIONAL [ :: ] name [ , name ]...

An entity with the OPTIONAL attribute must be a dummy argument.
<Semantics>

Declares that a dummy argument is optional. In a reference to a procedure with an optional dummy argument, no corresponding actual argument is needed. The PRESENT intrinsic function tests whether an optional dummy argument has a corresponding actual argument.

Note that a procedure with an optional argument must always be referenced with an explicit interface. This is automatic for module and internal procedures; for external or dummy procedures an INTERFACE block must be used.

An optional argument that is not present can be used as an actual argument to an intrinsic enquiry function that does not need its value, or as an actual argument corresponding to an optional dummy argument of any kind of procedure, but in no other way.

<Related>
INTERFACE statement, PRESENT intrinsic function, Type Declaration statement