From Wikipedia, the free encyclopedia
Jump to navigation Jump to search

Pascal is a programming language. It was created in 1970 by Niklaus Wirth, to help people learn how to make computer programs.

Now, there are many different dialects of the language, so a Pascal program written for one compiler can not easily be used with another one.

Code samples[change | change source]

This code prints "Hello world" at console window

1 program helloworld;
2 begin
3      WriteLn('Hello World');
4 end.

This code calculate factorial of positive integer, using recursion.

 1 program fac;
 2 var j:integer;
 3 function fact(i:integer):integer ;
 4 begin
 5      if i=0 then fact:=1 else
 6      fact:=i*fact(i-1);
 7 end ;
 9 begin
10      WriteLn('Enter number ');
11      Readln(j);
12      WriteLn(fac(j));
13      ReadLn;
14 end.

Pascal variants[change | change source]