Fortran 2003

SELECT TYPE

Purpose

The SELECT TYPE statement is the first statement in a SELECT TYPE construct. The construct can have any number of statement blocks, only one of which is selected for execution. The selection is based on the dynamic type of an expression which you specify in the selector, and the type of each type guard statement.

Syntax

Read syntax diagramSkip visual syntax diagram>>-+--------------------------+--SELECT TYPE--(--+--------------------+--selector--)-><
   '-select_construct_name--:-'                  '-associate_name--=>-'
 
select_construct_name
A name that identifies the SELECT TYPE construct.
associate_name
A name that is associated with the selector when executing the SELECT TYPE statement.
selector
An expression, evaluated when executing the SELECT TYPE statement. The result must be polymorphic.

Rules

If the selector is not a named variable, associate_name must appear. If the selector is not a definable variable or is a variable that has a vector subscript, associate_name must not appear in a variable definition context.

The selector must be polymorphic.

If the select_construct_name is specified, it must appear on the END SELECT statement and optionally on any type guard statements within the construct.

Related information

End of Fortran 2003