Title here
Summary here
Our first program will print the classic “hello world” message. Here’s the full source code.
program HelloWorld;
begin
WriteLn('Hello, world!');
end.
To run the program, save the code in a file with the .pas
extension and compile it using the Free Pascal Compiler (fpc
).
$ fpc HelloWorld.pas
$ ./HelloWorld
Hello, world!
Free Pascal allows us to compile programs directly into binaries. You can then execute the binary file.
$ fpc HelloWorld.pas
$ ls
HelloWorld HelloWorld.pas
We can then execute the compiled binary directly.
$ ./HelloWorld
Hello, world!
Now that we can run and build basic Pascal programs, let’s learn more about the language.