- 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
广告