[<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
program                  Declares a Program

 program <pname>(<parms>);

   <declarations>

 begin
   <statements>
 end.

    A program is a set of declarations, followed by a list of statements.
    When the program is run, execution starts with the first statement
    following BEGIN and continues until the statement just before END is
    executed. Note that END is followed by a period (.) rather than a
    semicolon. A Turbo Pascal program does not need a PROGRAM statement,
    since you can only have one program per source code file.

         <pname>    The program's name.

         <parms>    An optional list of parameters. If no parameters are
                    declared, then the parentheses are dropped. If the
                    parameters are there, they are ignored.

  <declarations>    Global LABEL, CONST, TYPE, VAR, PROCEDURE, and
                    FUNCTION declarations.

    <statements>    Zero or more legal statements.

  -------------------------------- Example ---------------------------------

           program Sum;

           var
             A,B,Sum : Integer;

           begin
             Write('Enter two values:  ');
             Readln(A,B);
             Sum := A + B;
             Writeln('The sum is ',Sum)
           end.

See Also: const type var procedure function begin end
This page created by ng2html v1.05, the Norton guide to HTML conversion utility. Written by Dave Pearson