- Fortran 教程
- Fortran - 主頁
- Fortran - 概覽
- Fortran - 設定環境
- Fortran - 基本語法
- Fortran - 資料型別
- Fortran - 變數
- Fortran - 常量
- Fortran - 運算子
- Fortran - 決策
- Fortran - 迴圈
- Fortran - 數字
- Fortran - 字元
- Fortran - 字串
- Fortran - 陣列
- Fortran - 動態陣列
- Fortran - 派生資料型別
- Fortran - 指標
- Fortran - 基本輸入輸出
- Fortran - 檔案輸入輸出
- Fortran - 程式
- Fortran - 模組
- Fortran - 內建函式
- Fortran - 數值精度
- Fortran - 程式庫
- Fortran - 程式設計風格
- Fortran - 除錯程式
- Fortran 資源
- Fortran - 快速指南
- Fortran - 有用的資源
- Fortran - 討論
Fortran - 巢狀選擇案例結構
你可以在另一 select case 語句內使用一個 select case 語句。
語法
select case(a)
case (100)
print*, "This is part of outer switch", a
select case(b)
case (200)
print*, "This is part of inner switch", a
end select
end select
示例
program nestedSelectCase
! local variable definition
integer :: a = 100
integer :: b = 200
select case(a)
case (100)
print*, "This is part of outer switch", a
select case(b)
case (200)
print*, "This is part of inner switch", a
end select
end select
print*, "Exact value of a is : ", a
print*, "Exact value of b is : ", b
end program nestedSelectCase
編譯並執行上述程式碼後,將生成以下結果 −
This is part of outer switch 100 This is part of inner switch 100 Exact value of a is : 100 Exact value of b is : 200
fortran_decisions.htm
廣告