title: Correct use of modules, subroutines and functions in Fortran
body: <p>I've recently learnt about interface blocks when adding a function to my Fortran program. Everything works nice and neatly, but now I want to add a second function into the interface block.</p>
  
  <p>Here is my interface block:</p>
  
  <pre><code>interface
      function correctNeighLabel (A,i,j,k)
      integer :: correctNeighLabel
      integer, intent(in) :: i,j,k
      integer,dimension(:,:,:),intent(inout) :: A
      end function
  
      function correctNeighArray (B,d,e,f)
          character :: correctNeighArray
      integer, intent(in) :: d,e,f
      character, dimension(:,:,:),intent(inout) :: B
      end function
  end interface
  </code></pre>
  
  <p>It appears to me that this may not be the best option. </p>
  
  <p>I've looked into subroutines, but I'm not very confident that it's the right solution. What I'm doing is relatively simple, and I need to pass arguments to the subroutine, but all the subroutines I've seen are a) complicated (i.e. too complicated for a function), and b) don't take arguments. They behave as though they manipulate variables without them being passed to them.</p>
  
  <p>I've not really looked into modules properly, but from what I've seen it's not the right thing to use.</p>
  
  <p>Which should I use when, and how do I go about it best?</p>