The margin is set at 150 characters. Whole expressions and individual parameter declarations including their type, going beyond the margin, shall be moved to the next line, and be indented by 2 spaces. Unit names in unit clauses going beyond the margin shall also be moved to the next line, at the same indentation as the line before.
Keywords (represented by bold in the Delphi IDE) are to be all lowercase
Constants are to start with a lowercase c.
All other identifiers are to start with a capital
• All declaration section headers(uses, type, const, procedure etc) are to start in the first column
• All declarations within a declaration section are to be indented by 2 spaces
• Code blocks (eg inside a try..finally, within a begin..end, code that is executed by an if or for statement) are to be indented 2 spaces
• Always consider as being before a declaration (aside from unit name at beginning)
• No blank lines within a declaration (i.e. record, class, method)
• No multiple blank lines
Spaces within lines:
• Only one space should separate identifiers, operators etc, i.e. no aligning of declarations using multiple spaces
• Operators must be separated by a space, eg:
LHeight := (Screen.Height / 2) + (Height / 2);
• No spaces before or after parentheses, except for before a constant array declaration
All statements, where possible, shall be terminated by a semicolon, even where the compiler will allow no semicolon.
The begin in a begin..end code block is to start on a new line.
Where the conditional code of an if/while statement spans more than one line, even if it is only one statement, the conditional code is to be enclosed in a begin..end block. The begin is to be aligned to the if. An if following the else in another if statement is to appear immediately after the else. e.g.
if SomeCondition then
else if SomeOtherCondition then
The code inside a repeat..until statement is to be indented 2 spaces
• Each case condition is to start on a new line, and be indented 2 spaces in relation to the case keyword
• Code blocks for the case condition that span more than one line are to be enclosed in a begin..end block, which is aligned to the condition, e.g:
case Key of