[prev] [index] [next]

Comments

Comments at the beginning of a program should indicate
  • purpose of program   (what it does/achieves)
  • environment of program   (inputs, outputs, files)
  • identification   (author, when written)
  • optional comments   (e.g. algorithm used)
Comments at the start of each function should indicate
  • purpose of procedure/function   (what it does/returns)
  • type and interpretation of parameters
  • conditions on parameters   (e.g. 0 <= n <= 10)