I have written some code in Fortran but not really gotten confident in how to structure longer codes.
I often want assumed-shape arrays
. This seem to be possible when using an interface block
, a module
or a contains
statement. However having the subroutine outside of the main code, without using any of these methods works for many cases, but not for assumed-shape arrays
.
In what context is each of these approaches preferred, and what is the main differences?
In what way are variables shared/inherited in each approach?