Clicky

Fortran Wiki
case (changes)

Skip the Navigation Links | Home Page | All Pages | Recently Revised | Authors | Feeds | Export |

Showing changes from revision #0 to #1: (追記) Added (追記ここまで) | (削除) Removed (削除ここまで) | (削除) Chan (削除ここまで)(追記) ged (追記ここまで)

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

Created on April 28, 2009 22:42:58 by Jason Blevins (71.70.142.190) (773 characters / 0.0 pages)
Edit | Views: Print | TeX | Source | Linked from: Keywords

AltStyle によって変換されたページ (->オリジナル) /