October 2, 2020โ€ข4 min read

Writing Your First Hello World Program in Pascal

With Free Pascal installed on Windows or Linux, it's time for your first program, plus a quick look around the Free Pascal IDE.

Read in Indonesian

After installing Free Pascal on windows or linux, this time we'll write our first code and get a little acquainted with the Free Pascal program.

No more beating around the bush: open Free Pascal.

On Windows, just double click the Free Pascal icon on the desktop.

On Linux, open a terminal with ctrl+alt+t, type the command fp, then press Enter.

On Windows, the Free Pascal interface shows up in its own application window, with the blue background typical of DOS.

๐Ÿ“ท Illustration: the Free Pascal IDE window on Windows.

On Linux, Free Pascal runs right inside the terminal, with a similar look.

๐Ÿ“ท Illustration: the Free Pascal IDE running inside a Linux terminal.

Free Pascal on Windows and Linux has the same functions. Only the opening view differs. Once you get to creating the file and running the program, the screens look the same.

Creating a New File

With the Free Pascal window open, the first thing to do is create a new Pascal file.

Creating a new file in Free Pascal is much like creating a new document in Microsoft Word: click File -> New in the top-left corner.

๐Ÿ“ท Illustration: the Free Pascal menu bar with the File and New options for a new program file.

After that, the editor opens a fresh blue worksheet, with a temporary file name at the top center: "noname01.pas".

noname01 is the temporary name of the file you just made, while .pas is the file extension for Pascal.

That name is only temporary. You'll replace it when you save the file. It works like creating a document in MS Word, which is automatically named Document.docx.

Writing the Pascal Code

The Pascal code we type this time is very simple. In any programming language, you'll most likely meet the beginner code called "Hello World".

Just type the following code in the Free Pascal window:

PASCAL
program HelloWorld;
uses crt;
begin
  clrscr;
  writeln('Hello World');
  readln;
end.

Nice. Once it's typed, check it over again. Don't leave a single typo, because one small slip makes the program error and it won't run.

All those lines of Hello World code sit neatly inside the Free Pascal editor.

๐Ÿ“ท Illustration: the complete Hello World program typed into the Free Pascal editor.

We'll discuss the code in a later installment. For now, just type what's there; we're focused on how Free Pascal works first.

Saving the File

With the code written, the next step is saving it. To save the file, click File -> Save.

๐Ÿ“ท Illustration: the Free Pascal menu bar showing the File and Save options.

Once Save is clicked, a small Save File As dialog appears in the middle of the screen.

๐Ÿ“ท Illustration: the Save File As dialog in Free Pascal, where the file name is set.

Next, name the file. Type the name into the input field below the word Name. In this example we'll call it "hello". When you're done, click OK.

๐Ÿ“ท Illustration: the name hello typed into the Name field of the Free Pascal save dialog.

After you click OK, the file name changes automatically from noname01.pas to hello.pas. Name it something else and it becomes <name>.pas.

๐Ÿ“ท Illustration: the Free Pascal editor title bar, now showing the new file name hello.pas.

Okee... the file is saved safely. On to the last step :D

Running the Pascal Program

The last step: running the code you typed. To run a Pascal program, click Run -> Run.

๐Ÿ“ท Illustration: the Run menu on the Free Pascal menu bar, used to execute the program.

After the click, compilation starts. Free Pascal translates Pascal into machine-language instructions. The machine reads them and prints the output "Hello World" on the console.

๐Ÿ“ท Illustration: the console output window showing the text Hello World from the Pascal program.

To get back to the Free Pascal window, just press Enter.

What's Next

Always remember the steps above, from creating a new file, saving the file, to running the program. You'll use them every time you write a Pascal program. If you forget, come back here hehe.

Hope this tutorial helps. In the next one we'll dissect this Hello World code and learn the structure of the Pascal language.

Get better at shipping code.

Join the other developers getting tech updates, tips, and relaxed tutorials in their inbox every week.

Stay in the loop

Tech updates, coding tips, and relaxed insights straight to your inbox every week.

No spam. Unsubscribe anytime.

Read next

See all
Struktur DataWhat a Linked List Actually Is

A linked list is a linear chain of nodes, each holding data and a pointer to the next node. Here is what that chain looks like, what it costs next to an array, and the same minimal implementation in Java, Python, and JavaScript.

For developers who learn by struggling

ยฉ 2026 Inva.dev.