First of all, please use monospaced (fixed-width) fonts.
These are the notations used by this styling guide:
Var s: String
,
Procedure Smt(s: String)
Program Example; // <-- OPTIONAL, but please don't use them
^-- // First letter of any keyword that's in the main block
// has to be capitallized, this makes main block
// easier to be recognized
| // <-- Blank lines between keywords in the main block
// Keep the code and comments in the 80-line bounary |
Uses BlankUnit, ExampleUnit;
// Short the units alphabetically, use Unit Namespace
|
Type
^-- // Same rules apply
TCount = SizeInt; // For all kind of counting <-- Explain everything :P
<> // Two spaces identing
| // Same rules
Procedure WriteSomething(s: String);
^-- // Same rules apply here, blank line however is not
// necessary
Var
^-- // As above
i: Integer;
<><> ^ // Ident by two spaces, no space before ':'
| // Blank lines
Begin
^--
for i := 1 to 10 do begin
<> // ^-- Inline,
write('Writing ', s);
<> // ^-- no space before ',' and a space after ','
write(' ', i, ' times')
<> ^ ^
end;
writeln();
^ // When calling a functions, brace yourself, even no args
// is passed
writeln('smt')// <-- No semicolon at end of block
End;
^--
Begin
^--
writeln('Hello'); // <-- For procedure in RTL, no namespace necessary
<>
case true of
false: writeln('Error');
<>
true : ExampleUnit.DoSomeThing() <-- no semicolon
end;
WriteSomething('Hi') // <-- You must call your function the way you
// defined it.
<>
End.
Unit ExampleUnit;
^--
Interface
^--
Procedure DoSomething();
<>^-- ^-- // Empty arg list needs brace too
Implementation
Procedure doSomethingElse()
^-- // Private function
Begin
^--
writeln('Doing something else')
End;
^--
|
Procedure DoSomething();
<>^--
Begin
<>^--
writeln('Doing something');
doSomethingElse()
<> ^--
End;
^--
End.