Subroutines

Pieces of code that are needed more than once should be turned into subroutines. This makes later corrections less risky,
and the code more structured. The label of the subroutine should correspond with its function.
Do not use numbers as names, it makes the code unreadable.
Variables used and declared only inside a subroutine should start with double underscore.

Style (italic texts should be replaced implicitly):

! ==============================================================================
!   Short description of the functionality
! ------------------------------------------------------------------------------
! Input Parameters:
!   par1:    short description (type)
!   par2:    short description (type)
!   ...
! Output:
!   par1:    short description
!   ...
! Remark:
!   Remarks for the caller
!   Description of key points of the implementation
! ==============================================================================

subroutine_title:
    ! body
return

Write the body of the subroutine indented by one tabulator field to the right.

Leave two empty lines behind the closing ‘return‘ of the subroutine.

Write one statement per line.

Subroutines shouldn’t be longer than 1-2 screens (about 80 lines) if possible.

Check all incoming parameters for validity and/or declare the restriction in comment.

The call and parameters keywords are lowercase.