The function with result() in f90 is developed to consistent with high level language like MATLAB. It's rather return the value of function to output variable rather than the function itself.
The rules are
We declare the output variables as an allocatable dummy array in both main and function.
We must allocate the dimension of output array inside the function.
We must allocate and assign input arrays at main before sending.
It should be noted that the function with result() returns only one variable (array or scalar).
For returning more than one variable, use subroutine to perform such a task.
Consider this lesson example
By concatenating arrays a and b, array c is sent to add to itself