TypechoJoeTheme

MetMan's Blog

网站页面
搜索到 1 篇与 的结果 ———
2024-07-31

Fortran BLOCK结构

Fortran BLOCK结构
Fortran 2008标准提出了BLOCK语法结构,其作用是创建一个独立的命名空间,在里面可以定义一个可以包含声明的可执行代码块。BLOCK语法如下:[block_name:] BLOCK ! declartion ! executable statements END BLOCK [block_name]其中block_name可选,对block结构起一个名字可以让代码更加清晰。BLOCK结构中声明对象包括变量、type定义、外部过程等,这些声明的对象作用域(生命周期)只限于该BLCOK结构,不会影响到BLOCK外的变量,这意味着你可以在BLOCK内声明一个与外部相同的变量名,在BLOCK内声明的变量如与外部变量名相同,外部变量会暂时被”抑制“。program main implicit none integer :: x = 10 block integer :: x x = 4 print*, "Inside a block, x=",x end block print*, "Out...
2024年07月31日
34 阅读
0 评论

互动读者

标签云

最新回复

暂无回复

登录
X
用户名
密码