2.9.1 How it works
A simple statement is an instruction that contains no others: defining, assigning, writing, reading, calling or returning. Each one ends with ;, including the last one before a closing word.
Compound statements contain others inside: If, Switch, While, Repeat, For. Their opening and closing lines have no semicolon; the simple statements inside do.
A While block with two statements inside. The two simple statements have a semicolon marked in green; the opening and closing lines have none, marked with an empty-set symbol in red.
ProgramWhere the semicolon goes
Algorithm Terminacion
Define i As Integer <- 0;
While i < 2 Do
Write "vuelta ", i;
i <- i + 1;
EndWhile
Define a As Integer <- 1; Define b As Integer <- 2;
Write a + b;
EndAlgorithmOutput
vuelta 0 vuelta 1 3
The program finishes normally.
Several statements can share a line if each has its semicolon. Empty lines produce no statement.
In short
- Simple statements end with
;. - Block openings and closings do not.
- Several statements are allowed on one line.