Modula-2 Standards

Naming - Indentation - Documentation

The most important thing of standards is being consequent, always using the same choices of naming, code structure, etc.
Your code will be easier to understand and to write, you will easier remember variable, type and procedure names.
So, we don't force you to use the following standards, it's ok if you create your own and follow them. Only be consequent.
The most commonly used (and widely accepted) standards are marked in bold.

Naming

Choose the names as follow:           TYPE PersonRc = RECORD          => records: suffix 'Rc'
           namePerson: ARRAY[1..35] OF CHAR;   => record fields: start with small letter
               lengthPerson: CARDINAL;

Indentation - Very Important!

Indentation is one of the most important ways to keeping long pieces of code readable. Without proper indentation, the program stucture is not visible and mistakes are easier to make and harder to trace!

Start a new line after every statement, except for write statements: you may group them on 1 line.

Indent with 2 or 3 spaces (or with a TAB - you can edit the tab size in the modula-2 editor to your own taste):


Documentation


Back to the top