In the Fortran2008 standard, the
block grammar is introduced, which allows a special
block to be constructed locally. What is the meaning of its existence?
```fortran label: blcok type :: variable command end block label ```
In some Fortran codes with poor experience, subroutines with more business may need to set many variables in the Fortran subroutines. This will cause “variable disasters”, difficult to read. And it may appear that the location where the variable is declared is far away from the location where it is used, resulting in a poor experience.
So I sometimes deliberately avoid this problem ( “variable disasters”), and occasionally use the
block syntax to “digest” some temporary variables.
As far as I know, go language and python language often declare and use variables nearby, which is a better experience.
Moreover, the c language seems to support the writing of nearby variables in the new standard.
Will Fortran also support this feature in the future:
It is not mandatory to declare variables at the head of the subroutine, and variables can be declared anywhere in the subroutine.