# Obsolete Fortran statement functions

Fortran 77 statement functions were thankfully made obsolete by Fortran 95 standard.
Statement functions are *not*
anonymous functions.
In most cases, one should simple use standard functions instead of confusing statement functions.
Other use cases are addressed by the polymorphism enabled from Fortran 2003 forward and/or pointers.

## Example

Here’s an example of replacing a Fortran statement function with a standard function.

```
program st
integer :: f,i,j,k,n
! obsolete statement function (don't use)
f(n) = n+(i*j)**k
i=2
j=3
k=4
print *,f
print *,g(i,j,k)
contains
integer function g(n,i,j,k) ! use this instead of statement function
integer, intent(in) :: n,i,j,k
g = n+(i*j)**k
end function g
end program
```

## Leave a comment