Skip to content

SpecificationII · Lexical structure

2.2

Spaces and line breaks

Spaces, tabs and line breaks only separate pieces: indentation does not change the meaning and a line break does not end a statement.

Markdown version

2.2.1 How it works

Between two words of a program there may be one space, many, or a line break: it makes no difference to the engine. Indentation (the spaces at the start of a line) has no meaning either. It is used so that people can see what is inside what, but the engine follows the opening and closing words, such as If and EndIf.

Figure 2.2-1.Two ways of writing the same program. The spaces change the shape, not the content.

Two boxes with the same If. The top one has tidy indentation; the bottom one, messy spaces. Below, an equals sign marks that they mean the same.

This program has careless indentation and extra spaces; even so it runs exactly like a well-written one:

ProgramCareless indentation

Algorithm   Desordenado
      Define   n   As Integer <- 3;
If n > 2 Then
Write    "mayor que dos";
      EndIf
EndAlgorithm

Output

mayor que dos

The program finishes normally.

2.2.2 A line break ends nothing

A line break does not replace the semicolon. If you forget the ;, the engine points it out even if the next statement starts on another line. Multi-word reserved words, such as Step or Until, cannot be split across two lines either.

In short

  • Spaces, tabs and line breaks only separate pieces.
  • Indentation means nothing to the engine, but a lot to people.
  • A line break does not replace the semicolon.