ZetCode

Pascal tutorials

Pascal is a compiled, statically typed language designed by Niklaus Wirth and published in 1970. It was created as a small, readable language for teaching structured programming, and it became one of the most influential languages of the personal-computer era. Turbo Pascal made it fast and affordable on MS-DOS, Delphi turned it into a full object-oriented development system, and Free Pascal keeps the language alive on modern platforms.

E-books

Pascal is strongly typed: every variable, parameter, and function result has a type, and the compiler rejects operations that do not fit. The language is also readable by design: keywords are words rather than symbols, blocks are closed by end, and declarations come before statements. The begin and end pair, the semicolon as a separator, and the assignment operator := are the rules that surprise newcomers most often, and the first articles explain each of them.

The examples are compiled and run with Free Pascal 3.2.2 in ObjFPC mode, a dialect with classes, interfaces, properties, exceptions, and generics that stays close to Delphi. Every example is a command-line program that starts with {$mode objfpc}{$H+}, is compiled with fpc -gl, and is run before its output is shown. Each article is self-contained.

Language basics

Program structure, variables, types and literals, enums and sets, operators, control flow, procedures, and units.

Arrays and strings

Static and dynamic arrays, string handling, and text processing.

Input and output

Formatted output and reading input from the console.

Records, classes, and generics

Records, object-oriented features, exception handling, interfaces, generic containers, and tabular text data.

Pointers and data structures

Pointers, linked lists, stacks, queues, and binary trees.

Algorithms

Recursion, sorting, searching, hash tables, and procedures passed as arguments.

Numbers and precision

Bits, IEEE floating point, arbitrary precision, complex numbers, and random numbers.

Numerical computing

Integration, root finding, linear algebra, and simulations.

System and runtime

Date and time, command-line arguments, the environment, and memory.

Concurrency and interoperability

Worker threads, shared state, and calling C libraries or exporting Pascal to C.

Tools, dialects, and legacy

Compiling, debugging, testing, style, the four dialects, and old Turbo Pascal code.

Programs and ports

A recursive-descent calculator and a guide to translating C code.

last modified November 19, 2026