Clicky

Fortran Wiki
associate (changes)

Skip the Navigation Links | Home Page | All Pages | Recently Revised | Authors | Feeds | Export |

Showing changes from revision #0 to #1: (追記) Added (追記ここまで) | (削除) Removed (削除ここまで) | (削除) Chan (削除ここまで)(追記) ged (追記ここまで)

Associate

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
Created on June 29, 2018 22:12:49 by Mr Blue? (91.16.88.222) (960 characters / 0.0 pages)
Edit | Views: Print | TeX | Source | Linked from: Keywords, control constructs

AltStyle によって変換されたページ (->オリジナル) /