Functions
Define a function in the contains block; the return value is assigned to the function name.
Simple enough for a 5-year-old to understand
function definition
Functions are defined after the "contains" block within the program. The return value is assigned to the NAME of the function.
program h print *, square(5)contains integer function square(x) integer :: x square = x * x end function squareend program h