Questions Concepts
GitHub icon


Pascal - Programming language

< >

Pascal is a programming language created in 1970 by Niklaus Wirth.

#29on PLDB 53Years Old 49kRepos

Try now: Riju

Pascal is an imperative and procedural programming language, which Niklaus Wirth designed in 1968–69 and published in 1970, as a small, efficient language intended to encourage good programming practices using structured programming and data structuring. It is named in honor of the French mathematician, philosopher and physicist Blaise Pascal. Pascal was developed on the pattern of the ALGOL 60 language. Read more on Wikipedia...

Example from Compiler Explorer:
unit output; interface function Square(const num: Integer): Integer; implementation // Type your code here, or load an example. function Square(const num: Integer): Integer; begin Square := num * num; end; end.
Example from Riju:
program Main; begin writeln('Hello, world!'); end.
Example from hello-world:
program HelloWorld(output); begin writeln('Hello World'); end.
{Hello World in Pascal} program HelloWorld(output); begin WriteLn('Hello World!'); end.
Example from Linguist:
uses uw27294; var p : procedure; procedure test; begin p:=@test; writeln('OK'); end; procedure global; begin p:=nil; test; p(); end; begin global;; end.
Example from Wikipedia:
program Printing; var i : integer; procedure Print(j : integer); begin ... end; begin { main program } ... Print(i); end.
Pascal Keywords
* + - / := < <= <> = > >= and begin boolean break byte continue div do double else end false if integer longint mod not or repeat shl shortint shr single then true until while word xor

Language features

Feature Supported Token Example
While Loops
Booleans true false
Strings '
Assignment :=
Case Insensitive Identifiers
s := (A + a + A);
Print() Debugging writeln
Function Overloading
program Adhoc;

function Add(x, y : Integer) : Integer;
    Add := x + y

function Add(s, t : String) : String;
    Add := Concat(s, t)

    Writeln(Add(1, 2));                   (* Prints "3"             *)
    Writeln(Add('Hello, ', 'World!'));    (* Prints "Hello, World!" *)
MultiLine Comments { }
(* A comment
{ This is a single line comment in pascal. But needs to be closed. }
Case Sensitivity X
Semantic Indentation X
Operator Overloading X
Line Comments X

View source

- Build the next great programming language · Search · Add Language · Features · Creators · Resources · About · Blog · Acknowledgements · Queries · Stats · Sponsor · Traffic · Traffic Today · Day 305 · · Logout