CASE statement

Standard: F77 F90 F95 F2003 F2008 F2018 Example program


CASE ( value [ ,value ]... ) [ construct-name ]

value ::= expression
| : expression
| expression :
| expression : expression

All expressions must be scalar, and of type Integer, Real, Logical or Character. The construct-name shall appear if and only if the SELECT CASE statement is named.


The CASE statement marks the beginning of a CASE part (and the end of any preceding CASE part). Statements in this part are executed if and only if the corresponding selector in the SELECT CASE statement satisfies the appropriate case condition:

(expression) selector = expression
(:expression) selectorexpression
(expression) selectorexpression
(expression1:expression2) expression1selectorexpression2


SELECT CASE construct, CASE DEFAULT statement, END SELECT statement, SELECT CASE statement