title: Function has no implicit type
body: <p>I am trying to learn to work with functions. I have the following code:</p>
  
  <pre><code>program main
    implicit none
  
    write(*,*) test(4)
  end program
  
  integer function test(n)
    implicit none
    integer, intent(in) :: n
    integer :: i, ans
  
    ans=1
    do i=1,n
    ans=ans*i
    enddo
  
    test=ans
  end function test
  </code></pre>
  
  <p>When I compile (with gfortran 4.1.2), I get the following error:</p>
  
  <pre><code>In file test.f90:4
  
    write(*,*) test(4)
             1
  Error: Function 'test' at (1) has no IMPLICIT type
  </code></pre>