You can define the return type before the function
symbol, but it is limited. It is an older way meant only for simpler cases. The rules are somewhat obscure and I do not remember them by heart, but here is what the standard says:
The type and type parameters (if any) of the result of the function defined by a function subprogram may be specified by a type specification in the FUNCTION statement or by the name of the result variable appearing in a type declaration statement in the specication part of the function subprogram. They shall not be specified both ways. If they are not specied either way, they are determined by the implicit typing rules in eect within the function subprogram. If the function result is an array, allocatable, or a pointer, this shall be specied by specifications of the name of the result variable within the function body. The specifications of the function result attributes, the specification of dummy argument attributes, and the information in the procedure heading collectively define the characteristics of the function (12.3.1).