063. Returning multiple values from a subroutine or function#

topic: Procedures

Note

This tip is a draft1.

Fortran cannot return multiple values with syntax like

c, d = f(x)

You can use a subroutine

call f(x,c,d)

or a function that returns a derived type containing c and d or a function that returns a size-2 array if c and d have the same type.



1

From the perspective of FortranTip Browser, “draft” means that it hasn’t been edited for formatting, hasn’t had corresponding Fortran programs added, the text content hasn’t been enhanced, etc. Draft texts are extracted from the corresponding Tweet using the Twitter API.