649pages on
this wiki
Add New Page
Comments0 Share

Pascal is an influential imperative and procedural programming language, designed in 1968/9 and published in 1970 by Niklaus Wirth as a small and efficient language intended to encourage good programming practices using structured programming and data structuring.

A derivative known as Object Pascal was designed for object-oriented programming.

Hello world

Pascal programs start with the program keyword with a list of external file descriptors as parameters; then follows the main block encapsulated by the begin and end keywords. Semicolons separate statements, and the full stop ends the whole program (or unit). Letter case is ignored in Pascal source.

Here is an example of the source code in use for a very simple "Hello world" program:

program HelloWorld(output);
  Writeln('Hello world!')

Data types

A type in Pascal, and in several other popular programming languages, defines a variable in such a way that it defines a range of values which the variable is capable of storing, and it also defines a set of operations that are permissible to be performed on variables of that type. The predefined types are:

Data type Type of values which the variable is capable of storing
integer Whole numbers
real Floating point numbers
boolean The value TRUE or FALSE
char A single character from an ordered character set

The range of values allowed for each (except boolean) is implementation defined. Functions are provided for some data conversions. For conversion of real to integer, the following functions are available: round, which round to integer using banker's rounding; trunc, round towards zero.

The programmer has the freedom to define other commonly-used data types (e.g. byte, string, etc.) in terms of the predefined types using Pascal's type declaration facility. e.g.

  byte = 0..255;
  signedbyte = -128..127;
  string = packed array [1..255] of char;

This page uses Creative Commons Licensed content from Wikipedia (view authors).

Ad blocker interference detected!

Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.