Skip to content

SpecificationII · Lexical structure

2.3

Comments

A comment starts with // and runs to the end of the line; the engine keeps it but does not run it.

Markdown version

2.3.1 How it works

A comment is a note for the people reading the program. It starts with two slashes, //, and ends where the line ends. It can take a whole line or go at the end of an instruction.

Figure 2.3-1.Whatever is to the right of the two slashes is a comment up to the end of the line. Inside a quoted text, the slashes are just characters.

Two program lines. In the first, what follows the two slashes is shaded and labelled comment. In the second, the two slashes are inside a quoted text and are labelled ordinary text.

ProgramComments in their place

Algorithm Comentarios
  // Calcula el área de un rectángulo
  Define base As Integer <- 4;
  Define altura As Integer <- 3;
  Write base * altura; // 4 por 3
  Write "// esto no es un comentario";
EndAlgorithm

Output

12
// esto no es un comentario

The program finishes normally.

The engine does not run comments, but it does not throw them away either: it keeps them so that the editor, the formatter and the profile translator leave them intact.

In short

  • // opens a comment up to the end of the line.
  • Inside a quoted text, // is ordinary text.
  • Comments are kept when formatting and translating.