Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Tabs should be used to indent all code blocks.  Spaces should never be used to indent code blocks.  Mixing tabs and spaces results in misaligned code blocks for other developers who prefer different indentation settings.  Consider the following code block which is indented with all tabs (shown with and without whitespaces):

Image Added

Image Added

Image Added

Indented properly with tabs
Indentation width set to 3
Whitespaces shown

Code is lined up properly

Indentation width set to 8
Code remains lined up properly


Now consider a situation where another developer is using an editor which is configured to indent using spaces by default.  The developer makes changes to 1 of the lines:

Image Added

Image Added

Image Added

Indented incorrectly with a mix of
tabs and spaces

Code appears lined up to the
developer who messed up the
indentation

Code is not lined up for other
developers

Comments

Variable Names

meaningful

...