Function has no implicit type

前端 未结 4 684
梦如初夏
梦如初夏 2020-12-06 11:07

I am trying to learn to work with functions. I have the following code:

program main
  implicit none

  write(*,*) test(4)
end program

integer function test         


        
4条回答
  •  挽巷
    挽巷 (楼主)
    2020-12-06 11:46

    Just put this:

    program main
      implicit none
    

    integer test

      write(*,*) test(4)
    end program
    ...
    

    You need to declare the function as a variable for the compiler to know the return type of the function.

提交回复
热议问题