A Pascal program starts with program Name;, optional uses units, declarations, then a main block begin ... end. (note the final period).
Pascal · Lesson 1 · On the house
Program structure
Program headers, begin/end blocks, writeln, compiler modes, and building with Free Pascal.
Lessons · Pascal · Lesson 1 of 10 · On the house
Program structure
Program headers, begin/end blocks, writeln, compiler modes, and building with Free Pascal.

writeln('text') prints a line, and write prints without a newline. Strings use single quotes. To put a quote inside one, double it: 'it''s'.
Free Pascal compiles with fpc hello.pas then ./hello. {$mode objfpc}{$H+} selects modern Object Pascal and long (AnsiString) strings. Most modern code uses it.
Pascal is case-insensitive. Statements are separated by ;.
Comments go in { ... } or (* ... *), or after // ... for the rest of the line.
hello
program Hello;
{$mode objfpc}{$H+}
begin
writeln('Hello from Pascal');
write('same ');
write('line');
writeln;
writeln('it''s ', 3, ' items');
WriteLn('case-insensitive');
end.
Quiz
What ends the main program block?
Quiz
How do you write a single quote inside a string?
Quiz
What does {$H+} change?
Quiz
Which call prints without a newline?
Check
Match the still for: Program structure.
Open-book: the answers are on this page. Pass every quiz and check (5) to mark the lesson done. This visit: 0/5.