Fortran: An ideal language for writing "Templates" of numerical algorithms (?)

I would also like to be able to return multiple values from a function, see the discussion here: Syntax of interactive Fortran - #18 by certik

We should create a standalone issue at the incubator repository to discuss this more.

I can see only one disadvantage: what if you use such a function in an expression? A short answer is that you would not be able to. The advantage is that it does not require any kind of a tuple type.

A long answer is that you could if we introduce a tuple type that would be the result. However, I would not, it seems it would open all kinds performance and design issues. Would it still be useful without a tuple type?

So a function that returns multiple values would indeed be similar to a subroutine. However, it is much more readable — you know exactly what are the “in” and “out” arguments. And since you cannot use a subroutine in an expression, it’s not a limitation that a function with multiple output values also cannot be.

1 Like