The else part may be omitted. The exit statement jumps to the statement after the next end do statement. Subroutines end with end subroutine . Note that the type of name has also to be declared in the calling program unless the function is in a module. In the body of the function a value must be assigned to the variable name .
Functions end with the end function .
Changing the value of an argument in the subroutine changes the value of the corresponding variable in the calling program. I recommend that you put your functions and subroutines in a module and use this module in the main program. If you do not do this , the names of functions must be declared in the main program, and in some cases interface statements must be used in the main program. Using modules allows complete typechecking at compile time, even if modules are compiled separately. A module begins with module name , then variables can be declared.