Intel® Fortran Compiler Classic and Intel® Fortran Compiler Developer Guide and Reference

ID 767251
Date 3/22/2024
Public
Document Table of Contents

SELECT CASE and END SELECT

Statement: Transfers program control to a selected block of statements according to the value of a controlling expression.

Example

 CHARACTER*1 cmdchar
 . . .
 Files: SELECT CASE (cmdchar)
   CASE ('0')
     WRITE (*, *) "Must retrieve one to nine files"
   CASE ('1':'9')
     CALL RetrieveNumFiles (cmdchar)
   CASE ('A', 'a')
     CALL AddEntry
   CASE ('D', 'd')
     CALL DeleteEntry
   CASE ('H', 'h')
     CALL Help
   CASE DEFAULT
     WRITE (*, *) "Command not recognized; please re-enter"
 END SELECT Files