Compound Statements (Blocks)

Compound statement, or block, is a list of statements enclosed by keywords begin and end:

begin
  statements
end;

Syntactically, a block is considered to be a single statement which is allowed to be used when Pascal syntax requires a single statement. Blocks can be nested up to the limits of memory.

For example, the while loop expects one statement in its body, so we can pass it a compound statement:

while i < n do
  begin
    temp := a[i];
    a[i] := b[i];
    b[i] := temp;
    i := i + 1;
  end;
Copyright (c) 2002-2012 mikroElektronika. All rights reserved.
What do you think about this topic ? Send us feedback!
Want more examples and libraries? 
Find them on LibStock - A place for the code