COMPOUND STATEMENT

Back to:
index

Practically in all Pascal constructions (IF/THEN/ELSE, WHILE/DO, FOR/TO/DO and others) syntax requires the only operator, for example
IF {some logical expression} THEN {operator};
But it is too poor possibility often. So what must we do when it is necessary to place several (more than one!) operators in the Pascal construction?

A special operator called compound statement will help us to solve the problem. It has very easy syntax: if you want compiler to have several operators as one, just inclose them by BEGIN and END reserved words. For example:
IF {some logical expression} THEN BEGIN {operator1}; {operator2}; {operator3} END;

Note that REPEAT/UNTIL cycle is an exception from this rule - it needn't BEGIN/END pair.

The existence of such construction gives possibility to determine which operators are included into construction and which are not. It just helps compiler to parse the program, but generates no executable code. So you can't see any example of translation here.



Back to:
index top