Changes between Version 9 and Version 10 of HowTo/FortranStandards


Ignore:
Timestamp:
2013-04-24T15:35:57+02:00 (11 years ago)
Author:
jryder
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • HowTo/FortranStandards

    v9 v10  
    6969}}} 
    7070 
     713) '''Comment at end of loop:''' If there is a loop within a loop (nested loop), or a lengthy single loop, it is helpful to repeat the loop instructions as a comment next to the END statement, as so: 
     72 
     73{{{ 
     74 
     75eta_3_surf = 0.0d0 
     76 
     77DO j = 1, nlevels 
     78 
     79    DO k = j, 1 
     80        jfactor = jfactor * (1.0d0 - jomega(k)) 
     81    END DO ! k = nlevels, 1 
     82 
     83    eta_3_surf = eta_3_surf + (jomega_surf * jomega(j) * jfactor * sbsigma * temp_leaf_pres(j)**4.0d0) 
     84 
     85END DO ! j = 1, nlevels 
     86 
     87}}} 
     88 
     893) '''Equations:''' Use brackets to improve readability (even though addition and subtraction are treated ahead of division and multiplication, it is easier for the reader to scan the equations if this is made explicit). Also, if the equation runs over several lines, try to break the expression at a close bracket or an addition/subtraction. 
     90 
     91e.g. '''a = (b * i) + (c / n)''' is easier to read than '''a = b * i + c / n''' 
     92 
     93 
    7194= DEFINITION OF VARIABLES = 
    7295