Fortran Wiki

The case construct is a replacement for the computed goto, but is better structured and does not require the use of statement labels:

select case (number)       ! number of type integer
case (:-1)                 ! all values below 0
   n_sign = -1
case (0)                   ! only 0
   n_sign = 0
case (1:)                  ! all values above 0
   n_sign = 1
end select

Each case selector list may contain a list and/or range of integers, character or logical constants, whose values may not overlap within or between selectors:

case (1, 2, 7, 10:17, 23)

A default is available:

case default

There is only one evaluation, and only one match.

category: keywords