Fortran Wiki
block (changes)

Showing changes from revision #1 to #2: Added | Removed | Changed

block

The Introduced in Fortran 2008, ablock creates its own name space. See the following example example:

program blockTest implicit none real, parameter :: x=1.1 print *, "before block: x=",x ! yields: 1.1 block integer, parameter :: x=2 print *, "inside block: x=",x ! yields: 2 end block print *, "after block: x=",x ! yields: 1.1 end program blockTest

One can also name each block for more clarity in larger programs programs:

program blockTest implicit none real, parameter :: x=1.1 print *, "before block: x=",x ! yields: 1.1 someName: block integer, parameter :: x=2 print *, "inside block: x=",x ! yields: 2 end block someName print *, "after block: x=",x ! yields: 1.1 end program blockTest