Hello, world

In the short history of computer programming, one enduring tradition is that the first program in a new language is a "Hello, world" to the screen. So let's do that. Copy and paste the program below into your IDE or text editor, then compile and run it.

If you have no idea how to do this, return to the Table of Contents. Earlier lessons explain what a compiler is, give links to downloadable compilers, and walk you through the installation of an open-source Pascal compiler on Windows.

program Hello;
begin
  writeln ('Hello, world.')
end.

The output on your screen should look like:

Hello, world.

If you're running the program in an IDE, you may see a console window appear and disappear in the blink of an eye. This is because the computer is so fast that the program finishes running in a fraction of a second. A simple workaround is to add a readln just before the end. (You will also need to add a semicolon to the end of the writeln statement.) This will instruct the computer to wait for you to press the Enter key before ending the program.

The "Hello, world" program then becomes:

program Hello;
begin
  writeln ('Hello, world.');
  readln
end.