begin Statement

The begin statement specifies a sequence of statements that are executed in order.

Scheme (begin S_1 S_2 ... S_n )
Pascal begin S_1 ; S_2 ; ... ; S_n end
C++, Java { S_1 ; S_2 ; ... ; S_n ; }

Note that the ; in Pascal is a statement separator, but in C++ and Java it is a statement terminator. There is no ; after the last statement in Pascal; having a ; in the wrong place may cause a syntax error.

Pascal:       C++, Java:

   begin                  {
      x := 7;                x = 7;
      y := sqrt(x)           y = sqrt(x);
   end                    }

Proper indentation is important to help humans read the code. However, indentation means nothing to the compiler, which relies on punctuation and reserved symbols such as begin - end or { }.

Contents    Page-10    Prev    Next    Page+10    Index