next up previous contents
Next: Simple Input / Output Up: Control Flow Previous: SELECT CASE Construct

Example Of SELECT CASE Construct

      SELECT CASE (num)

       CASE (6,9,99,66) 
     ! IF(num==9.OR. .. .OR.char==66) THEN
        PRINT*, "Woof woof"

       CASE (10:65,67:98)
     ! ELSEIF((num.GE.10.AND.LE.65) .OR. ...
        PRINT*, "Bow wow"

       CASE (100:)
     ! ELSEIF (num.GE.100) THEN 
        PRINT*, "Bark"

       CASE DEFAULT
     ! ELSE
        PRINT*, "Meeeoow"

      END SELECT     
     ! ENDIF

An IF .. ENDIF construct could be used but a SELECT CASE is neater and more efficient.

For more information, click here gif


next up previous contents
Next: Simple Input / Output Up: Control Flow Previous: SELECT CASE Construct

Adam Marshall ©University of Liverpool, 1996
Fri Dec 6 18:56:08 GMT 1996
Not for commercial use.