You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
module your_module
implicit none
integer :: n = 2
end module
program main
implicit none
real :: x
block
use your_module, only: n ! you can import modules within blocks
real :: y ! local scope variable
y = 2.0
x = y ** n
print *, y
end block
! print *, y ! this is not allowed as y only exists during the block's scope
print *, x ! prints 4.00000000
end program
However the linter marks that as an error.
The text was updated successfully, but these errors were encountered:
As indicated in https://fortran-lang.org/learn/quickstart/variables/, modules can be used inside
BLOCK
:However the linter marks that as an error.
The text was updated successfully, but these errors were encountered: