Spaghetti Code

Code Structure


description

Comments

Programmers use comments to make their code more understandable. Comments are sections of text that a computer will ignore, but that humans can still read. The best comments reside in 2 places:
  • At the start of a program
  • At the start of a computation
Comments should explain, in general terms, what a piece of code is, what it does, and (if applicable) how to customize it. Comments at the start of the program should also include the name of the programmer, a general overview of what the program is, and what functions the program uses. Functions are just a series of instructions that take one or more inputs and return an output. Functions should also have a comment to explain what to input, what the function does to that input, and what it outputs.

Notice that the comments still follow the rules for alignment and spacing. And comments to the side of code should still align.