title: Function result has no implicit type
body: <p>Below is a sample code that addresses the problem I am having.  The error message I am getting is</p>
  
  <blockquote>
    <p>Function result 'sample' at (1) has no IMPLICIT type.</p>
  </blockquote>
  
  <p>I label where line (1) is below.</p>
  
  <p>I tried to follow <a href="https://stackoverflow.com/questions/17751863/function-has-no-implicit-type">this other question</a>, however I wasn't able to figure it out. This function is within a module in my program and I made sure that the module has <code>contains</code> and I end the module after this function.</p>
  
  <p>I also use <code>implicit none</code> in this function so I'm not sure why I get this message. How can I fix this error message?</p>
  
  <p>Adding <code>Real</code> or <code>Complex</code> in front of <code>function</code> works, but I don't really get why.  Shouldn't I only be able to use complex since the arrays are complex inside the function? Which is more suitable for my actual function?  Both yield no compilation errors.</p>
  
  <pre><code>real function Sample(func)   !this is line (1)
  !complex function Sample(func)
  
  implicit none
  
  integer :: n,m
  real :: x,y
  complex, dimension(-9:9,-9:9), intent(in) :: func
  complex, dimension(-9:9,-9:9) :: LocalF
  
  LocalF = func
  
  do n=-9,9
  do m=-9,9
  
      x = real(n)*0.2
      y = real(m)*0.2
      LocalF(n,m)= cmplx(z1(x,y),z2(x,y)) !assume z1,z2 are well defined
  
  end do
  end do
  
  end function Sample
  </code></pre>