Free Pascal Cookbook¶
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)
- User's Guide: Learn the basics of using the compiler.
- Programmer's Guide: Explore programming with Free Pascal.
- Language Reference: The complete guide to the Object Pascal language.
- For all FPC guides, see the FPC Documentation Page.
Lazarus IDE
- Lazarus Documentation: Your main hub for Lazarus guides, including the LCL (Lazarus Component Library).
- Lazarus FAQ: Find answers to common questions.
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 Lazarus IDE installer for your computer.
- This installs both FPC and Lazarus IDE together.
- 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:
- Free Pascal Compiler: FPC on GitLab
- Lazarus IDE: Lazarus on GitLab
- Code snippets from this site: free-pascal-snippets on GitHub
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:
- Unofficial Free Pascal Discord - Real-time chat with the community
- Free Pascal & Lazarus Forum - The official discussion forum
- Tweaking4All Forums - Active community with lots of helpful discussions
- Laz Planet - Great blog with tutorials and tips
- Delphi Basics - Reference for Object Pascal basics
- Stack Overflow - Tag your questions with
freepascal
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.
