Home Formatting lines

One statement per line

Place each statement on its own line.

Long lines

All lines of code must be 80 characters or less in width, including indents and comments. Expand for strategies on handling long lines which you cannot shorten.

Blank lines

Leave a single blank line between each significant chunk of code. At minimum, leave one blank line between each method. Do not write multiple consecutive blank lines. Do not leave a blank line after an opening curly brace, or before a closing curly brace.

Spacing

Place spaces to enhance readability. Be sure to place spaces such that your code is neither too cramped nor too expansive. Expand for a list of specific spacing rules with examples.