Top 1K Features Creators Events Podcasts Books Extensions Interviews Blog Explorer CSV

Pascal

< >

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

#48on PLDB 54Years Old 49kRepos
REPL · Download · Wikipedia · Subreddit · FAQ · Release Notes · Demo Video · Docs · Mailing List

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; uw27294.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 Example Token
Conditionals
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; begin Add := x + y end; function Add(s, t : String) : String; begin Add := Concat(s, t) end; begin Writeln(Add(1, 2)); (* Prints "3" *) Writeln(Add('Hello, ', 'World!')); (* Prints "Hello, World!" *) end.
MultiLine Comments (* A comment *) { }
Comments { This is a single line comment in pascal. But needs to be closed. }
Polymorphism
Case Sensitivity X
Semantic Indentation X
Operator Overloading X
Line Comments X
- Build the next great programming language · Add · About · Search · Keywords · Livestreams · Labs · Resources · Acknowledgements · Part of the World Wide Scroll