title: Declaring variables in in Fortran
body: <p>Why does this piece of code not work and what is the alternative? </p>
  
  <pre><code>module find_integers_module  
    implicit none
    contains  
    integer function function1(r) result(rnext)   
      implicit none   
      integer,intent(in) :: r     
      integer :: k = r    
      rnext = -1          
    end function function1     
  end module
  </code></pre>