intent (Fortran)

Applies to: fortran

The intent attribute declares how a procedure uses an argument: intent(in) is read-only, intent(out) is written by the procedure, intent(inout) is both. The compiler enforces it (catching writes to inputs) and uses it to optimize.

subroutine forces(q, s, lift)
  real, intent(in)  :: q, s     ! read-only
  real, intent(out) :: lift     ! written here
  lift = q * s
end subroutine

See also: module, reference