Clicky
Showing changes from revision #0 to #1:
(追記) Added (追記ここまで) | (削除) Removed (削除ここまで) | (削除) Chan (削除ここまで)(追記) ged (追記ここまで)
The associate construct yields simple abbreviations for more complex statements. It can be an alias for expressions or variables. See the following example
program associateTest
implicit none
integer :: a=1,b=1
associate( x => a*b )
print *, x ! yields: 1
a=10
print *, x ! yields: 1
end associate
associate( x => a )
print *, x ! yields: 10
a=100
print *, x ! yields: 100
end associate
end program associateTest
One can also name associate for more clarity in larger programs
program associateTest
implicit none
integer :: a=1,b=1
someName: associate( x => a*b )
print *, x ! yields: 1
a=10
print *, x ! yields: 1
end associate someName
end program associateTest