Basic Example#

Here’s a simple Fortran module with comprehensive documentation:

example_01.f90#
module math_utils
  !> This module provides utilities for mathematical operations
  implicit none

  contains

  !# Preceding doc.
  !> Adds two integers and returns the result
  !> but the comment continues in the next line
  subroutine add_integers(a, b, c)

    !> The first integer to add
    integer, intent(in) :: a   
    !> The second integer to add
    integer, intent(in) :: b   
    !> The result of the addition
    integer, intent(out) :: c  
    c = a + b
  end subroutine add_integers

  !> Multiplies two real numbers and returns the result
  elemental function multiply_reals(x, y) result(res)
    real, intent(in) :: x , y  !> The real numbers to multiply
    real :: res  !> The result of the multiplication
    res = x * y
  end function multiply_reals

  !> Norm of array
  pure function norm_array(array) result(res)
    real, intent(in) :: array(:)  !> The real numbers to multiply
    real :: res  !> The result of the multiplication
    res = norm2(array)
  end function norm_array

end module math_utils

math_utils (module)#

This module provides utilities for mathematical operations

Procedures

add_integers (subroutine)#

subroutine add_integers(a, b, c)

Adds two integers and returns the result but the comment continues in the next line

Arguments:
ainteger, intent(in)

The first integer to add

binteger, intent(in)

The second integer to add

cinteger, intent(out)

The result of the addition

multiply_reals (function)#

elemental function multiply_reals(x, y) -> res

Multiplies two real numbers and returns the result

Arguments:
xreal, intent(in)

The real numbers to multiply

yreal, intent(in)

The real numbers to multiply

Returns:
resreal

The result of the multiplication

norm_array (function)#

pure function norm_array(array) -> res

Norm of array

Arguments:
arrayreal, intent(in), dimension(:)

The real numbers to multiply

Returns:
resreal

The result of the multiplication