The program shape in Delphi
A lighthouse log greeting built from the smallest set of parts a Delphi program needs.
// Every Delphi program opens with a program header and ends with end.
program HelloProgram;
uses SysUtils; // SysUtils supplies Format and other helpers
const
Station = 'Pigeon Point';
Keeper = 'A. Marrow';
begin
// Statements sit between begin and end, separated by semicolons.
WriteLn('lighthouse log opened');
WriteLn(Format('station: %s', [Station]));
WriteLn(Format('keeper on watch: %s', [Keeper]));
// The closing end of a program takes a period, not a semicolon.
end.
How it works
program HelloProgram;names the program anduses SysUtils;pulls inFormat.- The
constblock fixesStationandKeeperbefore the body starts. - Three
WriteLncalls run betweenbeginandend., which closes with a period.
Keywords and builtins used here
FormatWriteLnbeginconstendprogramuses
The run, in numbers
- Lines
- 15
- Characters to type
- 483
- Tokens
- 57
- Three-star pace
- 80 tpm
At the three-star pace of 80 tokens a minute, this run takes about 43 seconds.
Step 1 of 3 in Programs & variables, step 1 of 27 in Language basics.