Pascal

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

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

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

program helloworld;
begin
     WriteLn('Hello World');
end.

This code calculate factorial of positive integer, using recursion.

program fac;
var j:integer;
function fac(i:integer):integer ;
begin
     if i=0 then fact:=1 else
     fact:=i*fact(i-1);
end ;
 
begin
     WriteLn('Enter number ');
     Readln(j);
     WriteLn(fac(j));
     ReadLn;
end.

Pascal variants[change | change source]