Pascal

Pascal is a statically typed programming language. It was designed as a language for education. It is generally a compiled language.

Several derivatives of Pascal exist which enhance the language, such as Object Pascal.

Example Code

Here is an example of the 100 doors problem:

program OneHundredDoors;
 
var
	doors	: Array[1..100] of Boolean;
	i, j	: Integer;

begin
	(* Initialize the array of doors to closed *)
	for i := 1 to 100 do
		doors[i] := false;
	
	(* Process the doors *)
	for i := 1 to 100 do begin
		j := i;
		while j <= 100 do begin
			doors[j] := not doors[j];
			j := j + i
		end
	end;
	
	(* Print out the results *)
	for i := 1 to 100 do begin
		Write('Door #', i, ' is ');
		if doors[i] then
			WriteLn('open.')
		else
			WriteLn('closed.');
	end;
end.

Why would I learn this language?

Pascal is considered to be one of a few languages which one can learn completely. The language is deliberately limited and (by default) there are few external libraries. In this sense, learning Pascal is a finite process.

Pascal has a simple syntax and easy to understand type system. Programs are generally fairly easy to read and write.

Pascal is a fairly well established language, but is also not very modern.

Starting Points

Learn Pascal
Beginner guide to programming using Pascal.
Free Pascal
Open Source Compiler for Pascal and Object Pascal.

Further Reading

comments powered by Disqus