Skip to content
LumenaryAcademy

Lumenary CS · Programming languages

Pascal and Object Pascal

Niklaus Wirth's teaching language and the Object Pascal of Turbo Pascal, Delphi, Free Pascal and Lazarus: clear, compiled and still building desktop applications today.

Pascal was designed by Niklaus Wirth and published in 1970 to teach programming as a clear, systematic discipline. Its readable, strongly typed, block-structured style made it the language of computing classrooms for two decades, and Borland's Turbo Pascal made it a fast, practical tool on personal computers. Object Pascal, the language of Delphi and Free Pascal, added units, classes, properties, interfaces, exceptions and generics, and it is still used to build native desktop and cross-platform applications, especially with the Lazarus and Delphi visual designers.

This course teaches modern Object Pascal as compiled by Free Pascal 3.2, the current stable release as of late 2026, and points out where Embarcadero Delphi differs. It goes from a first program through types, control flow, procedures, arrays, records, sets and strings, units and pointers, to classes, properties, interfaces, exceptions and generics, and ends with how GUI applications are built in Lazarus and Delphi and a complete command-line project. It assumes the Start level of Lumenary CS or equivalent experience: you know what a variable, a loop and a function are. No previous Pascal is needed.

To run the programs, install the Free Pascal compiler from freepascal.org (on Debian and Ubuntu, sudo apt install fpc), or install Lazarus, whose installers include Free Pascal and add a full IDE. Embarcadero offers Delphi, with a free Community Edition under licence conditions. There is no official online playground, but Compiler Explorer can compile Pascal in the browser. Every program in this course was compiled and run with Free Pascal 3.2.2.

AI-draftedAwaiting review by a computer scientist
  • Chloe · The Designer
    “Why is the language built this way?”
  • Margaret · The Profiler
    “What does it print, and what does it cost?”
  • Gideon · The Language Lawyer
    “What exactly does the language guarantee?”

Foundations · 3 lessons

The core language

Wirth's Pascal and its descendants, compiling with Free Pascal, types and control flow, and procedures and functions with value, var, const and out parameters.

  1. 1First steps in PascalWirth's teaching language, the Turbo Pascal and Delphi years, Free Pascal and Lazarus today, and a first compiled program. 50 min
  2. 2Types and control flowOrdinal, real and currency types, enumerations and subranges, range checking, and Pascal's if, case and loop statements. 55 min
  3. 3Procedures and functionsValue, var, const and out parameters, Result and Exit, nesting, overloading, recursion and procedural types. 50 min

Practice · 2 lessons

Data, units and memory

Arrays, records, sets and strings for modelling data, units for organising programs, and pointers and dynamic memory as Pascal frames them.

  1. 4Arrays, records, sets and stringsStatic and dynamic arrays, open array parameters, records with variants and methods, Pascal's built-in sets, and strings that behave like values. 55 min
  2. 5Units, pointers and memoryOrganising programs into units with interfaces and implementations, then typed pointers, the heap, and how Object Pascal decides what is freed for you. 55 min

Professional · 3 lessons

Object Pascal as professionals write it

Classes, properties and interfaces, exceptions and generics, and how Lazarus and Delphi build GUI applications, ending with a complete project.

  1. 6Classes, properties and interfacesObject Pascal's class model, from constructors and destructors to properties and events, inheritance with virtual methods, and reference-counted interfaces. 60 min
  2. 7Exceptions and genericsRaising and handling exceptions with your own exception classes, try … except and try … finally, then generic classes and functions and the Generics.Collections library. 60 min
  3. 8GUI applications, professional tools and a complete projectHow Lazarus and Delphi build desktop applications from forms, components and events, the tools Object Pascal professionals use every day, and a complete library-loans project with tests, written as a console program. 70 min

Further reading and resources

  • Free PascalThe open-source Object Pascal compiler for many platforms, with downloads and news.
  • Free Pascal documentationThe Reference Guide (the language), the Programmer's Guide, the User's Guide and the RTL and FCL library references.
  • Free Pascal Reference GuideThe definition of the Object Pascal language as Free Pascal implements it, including its compiler modes.
  • Free Pascal and Lazarus wikiCommunity documentation, tutorials and answers to common questions.
  • LazarusThe free, cross-platform IDE and visual designer for Free Pascal, with the LCL component library.
  • Embarcadero DocWikiEmbarcadero's documentation for RAD Studio and Delphi, including the Delphi language guide and the VCL and FireMonkey libraries.
  • Compiler ExplorerCompile Pascal in the browser and see the machine code it produces.