Fortran - Programming Style

Programming style is all about following some rules while developing programs. These good practices impart values like readability, and unambiguity into your program.

A good program should have the following characteristics −

For example, if you make a comment like the following, it will not be of much help −

! loop from 1 to 10 
do i = 1,10  

However, if you are calculating binomial coefficient, and need this loop for nCr then a comment like this will be helpful −

! loop to calculate nCr 
do i = 1,10
real :: x 
x = sin(y) + 1.0

if (x >= 0.0) then
   z = sqrt(x)
end if