A collection of Free Pascal snippets that I put together while learning Object Pascal.
This repo is part of my study note — Free Pascal and Lazarus Cookbook.
Explore the docs »
Explore Contents
·
Read Free Pascal and Lazarus Cookbook
·
View Cookbook repo
This repository contains a collection of Free Pascal code snippets (work in progress) that I put togehter while studying Object Pascal with the Lazarus IDE and the Free Pascal Compiler (FPC).
It is a part of the Free Pascal and Lazarus Cookbook project.
The source code is organized into the following categories:
- HelloWorld/ - The starting point; a 'Hello World' program
- Variables/ - Examples of setting up variables in Free Pascal
- Numbers/ - Examples of using numbers
- Strings/ - Examples of using strings
- Arrays/ - Examples of creating arrays
- Lists/ - Examples of building lists
- Loops/ - Examples of loops
- FuncProc/ - Example of creating routines (functions and procedures)
- Class/ - Examples of composing classes
- Records/ - Examples of composing records
- Interfaces/ - Examples on using Interfaces
- Generics/ - Example on using Generics
- AnonymousFunctions/ - Examples of anonymous functions
- FunctionReferences/ - Snippets on Function References (requires trunk)
- Threading/ - Examples of setting up threads
- Immutability/ - A note on setting variables immutable
- Subrange/ - Examples of using the subrange type
- ConsoleInputOutput/ - Simple examples on console IO
- CommandLineArguments/ - Examples on parsing command line arguments and options
- DirsPathsFiles/ - Examples of composing paths
- FileHandling/ - Snippet on file handling; reading and writing
- FileHandling_II/ - Snippet on file handling of other file formats; CSV
- DateTime/ - Snippets about date manipulation
- Debugging/ - Examples of debugging
- Regex/ - Examples of utilizing Regex
- Networking/ - Examples of using networking
- CodeStructure/ - Examples on structuring Pascal source files
- LGenerics/ - Examples of using LGenerics
- Mormot2/ - Examples of using mormot2
- NumLib/ - Examples of using Numlib
- Lazarus/ - A GUI of 'Hello World' in Lazarus IDE
When you compile any project, the executable output will be placed in the top-level bin/
folder of the repository.
Why? This keeps the compiled binaries separate from the source code and makes it easier for me to manage multiple examples.
- Interest in Object Pascal.
- Install both the Free Pascal Compiler (FPC) and Lazarus IDE. You can use the Lazarus IDE installer or
fpcupdeluxe
to install both.
None. Just download or git clone
the repo to your local drive.
- Launch your Lazarus IDE.
- Top bar menu, go to
Projects
-Open Project ...
. - Navigate to the snippet folder you'd like to see, and open the
.lpi
file.
- Navigate to an example folder.
- Open the
.lpr
file. This is the program source code.
Distributed under the MIT License. See LICENSE.md
for more information.
Find me at these places:
- @ikelaiah on GitHub
- the Unofficial Free Pascal & Lazarus discord server.
Project Link: https://github.com/ikelaiah/free-pascal-snippets
-
The FPC devs for sharing the joy of Object Pascal.
-
The Lazarus IDE devs for making such an amazing IDE.
-
The dedicated people behind various units/modules in OPM.
-
The kind and helpful individuals on various online platforms such as;