How to Indent Code

Indenting Your Code -- Don't Be That Guy

The Rules:

  1. Indent only at the beginning of the line
  2. Use a (real) tab or spaces to indent
    1. Preferably a tab, it has a deep history related to indention and in software it tends to mean "indent"
  3. Be consistent
    1. No space character shall immediately follow a tab character to indicate a full level of indention
    2. If using spaces to indent, use the same number of spaces to represent an indention level
  4. No tab shall come after a non-tab character on a line
    1. This supercedes the rule about consitency -- formatting data, especially comments, not related to indention should be done with spaces

Questions and Answers: