END (Construct)
Purpose
| Construct | Termination Statement |
|---|---|
| ASSOCIATE 1 | END ASSOCIATE |
| BLOCK 2 | END BLOCK |
| DO | END DO |
| DO CONCURRENT 2 | |
| DO WHILE | |
| FORALL | END FORALL |
| IF | END IF |
| SELECT CASE | END SELECT |
| SELECT TYPE 1 | |
| WHERE | END WHERE |
| Notes:
|
|
Syntax
>>-END--+-ASSOCIATE--+------------------------------+----+----->< | | (1) | | | '-ASSOCIATE_construct_name-----' | +-BLOCK--+--------------------------+------------+ | | (2) | | | '-BLOCK_construct_name-----' | +-DO--+-------------------+----------------------+ | '-DO_construct_name-' | +-FORALL--+-----------------------+--------------+ | '-FORALL_construct_name-' | +-IF--+-------------------+----------------------+ | '-IF_construct_name-' | | (3) | +-SELECT--+-+---------------------+--------+-----+ | | '-CASE_construct_name-' | | | '-+----------------------------+-' | | '-SELECT_TYPE_construct_name-' | '-WHERE--+----------------------+----------------' '-where_construct_name-'
- Fortran 2003
- Fortran 2008
- Fortran 2003
- ASSOCIATE_construct_name (Fortran 2003)
- A name that identifies an ASSOCIATE construct.
- BLOCK_construct_name (Fortran 2008)
- A name that identifies a BLOCK construct.
- DO_construct_name
- A name that identifies a DO,
DO
CONCURRENT
, or DO WHILE construct. - FORALL_construct_name
- A name that identifies a FORALL construct.
- IF_construct_name
- A name that identifies an IF construct.
- CASE_construct_name
- A name that identifies a SELECT CASE construct.
- SELECT_TYPE_construct_name (Fortran 2003)
- A name that identifies a SELECT TYPE construct.
- where_construct_name
- A name that identifies a WHERE construct.
Rules
If you label the END
DO statement, you can use it as the terminal statement
of a labeled or unlabeled DO,
DO
CONCURRENT
, or DO WHILE construct.
An END DO statement terminates the innermost DO,
DO CONCURRENT
, or DO WHILE construct
only. If a DO,
DO
CONCURRENT
, or DO WHILE statement
does not specify a statement label, the terminal statement of the DO or DO
WHILE construct must be an END DO statement.
| Construct name | Branch from inside | Branch from outside | Branch target |
|---|---|---|---|
| ASSOCIATE 1 | √ | END ASSOCIATE 1 | |
| BLOCK 2 | √ | √ | END BLOCK 2 |
| DO | √ | END DO | |
| DO CONCURRENT 2 | √ | ||
| DO WHILE | √ | ||
| IF 3 | √ | √ | END IF |
| CASE | √ | END SELECT | |
Notes:
|
|||
If you specify a construct name on the statement that begins the construct, the END statement that terminates the construct must have the same construct name. Conversely, if you do not specify a construct name on the statement that begins the construct, you must not specify a construct name on the END statement.
An END WHERE statement must not be a branch target statement.
Examples
INTEGER X(100,100)
DECR: DO WHILE (I.GT.0)
...
IF (J.LT.K) THEN
...
END IF ! Cannot reference a construct name
I=I-1
END DO DECR ! Reference to construct name DECR mandatory
END
BW: WHERE (A /= 0)
B = B + 1
END WHERE EW ! The where_construct_name on the END WHERE statement
! does not match the where_construct_name on the WHERE
! statement.



