Is creating nested subroutines/functions considered good practice in Fortran?

@FortranFan your example works with LFortran also:

$ lfortran x.f90 
In eval: f(x) =  1.00000000e+04

I must say I am pleasantly surprised that it actually worked! We are in alpha, meaning I expect things to break. :slight_smile:

@ivanpribec yes, I use nested functions for callbacks often, I think it’s a clean and fast way to do it.

4 Likes