Skip to content

Free Pascal Cookbook

Cooking

Warning

This document is a work in progress.

Contents are still being revised and added.

Welcome to my Free Pascal Cookbook!

This is a collection of practical examples and tutorials for learning Object Pascal with the Free Pascal Compiler (FPC) and Lazarus IDE. Whether you're just starting out or you're picking up a new language, you'll find clear explanations and code you can try right away.

New to Free Pascal? Start with Hello, World! and then explore common data types.

For more tutorials and links, check out Resources.

Install FPC Official Documentation

Why Free Pascal?

Quick to Build

Build working programs fast with visual tools and built-in helpers.

Works Everywhere

Write your code once, then run it on Windows, Mac, Linux, and more!

Easy to Read

The code reads like English, so it's easier to understand and fix mistakes.

Super Fast

Your programs run really fast because they're compiled, not slowed down by interpretation.

Reliable & Modern

Used by professionals for serious projects. Plus it has modern features you'll want to learn.

Lots of Tools

Pre-made pieces you can use and helpful libraries for building different types of programs.

Official Documentation

Once you've learned the basics here, the official guides have everything else you need. Don't worry if they look long at first—this cookbook will help you understand them!

Free Pascal Compiler (FPC)

Lazarus IDE

Installation

To try the code examples on your computer, you need the Free Pascal Compiler (FPC).

Not sure which to choose? Most beginners should pick FPC and Lazarus IDE because Lazarus has a visual editor that makes coding easier.

  • Download the FPC installer for your computer.
  • Use this if you prefer to use a text editor like VS Code instead of Lazarus IDE.

We tested with: FPC 3.2.2 and Lazarus IDE 3.6.

Want to Explore More?

As you get more comfortable with Free Pascal, you might want to see how Free Pascal and Lazarus are actually built. Here are the main projects:

Thanks to the Community

Built with help from the amazing Free Pascal and Lazarus community. Here are some great places to ask questions and learn:

Note

Code snippets on this site work with FPC 3.2.2 and Lazarus 4.0 on Win 11. Except for the ones that require FPC trunk (anonymous methods and function references).

Warning

This document is a work in progress.

Contents are still being revised and added.