Learn Pascal Programming with Mc Kenzie

Pascal is a high-level programming language that was developed specifically to teach students structured programming techniques. It is a teaching language like Basic and while it is not difficult to learn you need to spend some time working with Pascal before you can master its syntax.

You will need a pascal compiler installed on your computer inorder to write the source code but you do not need one right now so let us get the ball rolling.

Welcome to the Pascal World!

 

Dear Students

Let us begin writing source code

Program 1.1

This is a simple but complete pascal program which finds the sum of two numbers 13 and 12 then prints the output 25.

program addversion1(output);
begin
   writeln(13 + 12)
   end.

This program has two parts.

1. The Program Heading
2. The Body

1.0   The Program Heading starts with the word PROGRAM followed by the name of the program. Each program must have a name. The name of the program is chosen by the programmer who writes the program. The name of the program is followed by the word output which is within braces. Some versions of Pascal do not require this. Finally the heading ends with a semi-colon.

Here is a second version of the same program :

program addversion2;
begin
   writeln(13 + 12)
   end.

2.0    The body of the program starts with BEGIN followed by one or more statements and ends with the word END. Please remember the program ends with a full stop after the word END.

Program 1 has only one statement :

WRITELN(13 + 12)

WRITELN stands for "write a line".The WRITELN statement instructs Pascal to add 13 to 12 then print the sum of both numbers. It does not matter to Pascal whether capital letters are used or not.

BSS Main | Next Lesson |