| 71 | 3) '''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 | |
| 75 | eta_3_surf = 0.0d0 |
| 76 | |
| 77 | DO 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 | |
| 85 | END DO ! j = 1, nlevels |
| 86 | |
| 87 | }}} |
| 88 | |
| 89 | 3) '''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 | |
| 91 | e.g. '''a = (b * i) + (c / n)''' is easier to read than '''a = b * i + c / n''' |
| 92 | |
| 93 | |