typestar

Procedures in Delphi

A procedure reports one hive inspection, and the main block only calls it.

program ProceduresBasics;

// A procedure does work and answers nothing; call it as a statement.
procedure InspectHive(Number: Integer; const Queen: string);
begin
  WriteLn('Hive ', Number, ': queen ', Queen);
end;

// One procedure may call another, so the main block stays short.
procedure InspectApiary;
begin
  InspectHive(1, 'Hazel');
  InspectHive(2, 'Juniper');
end;

begin
  InspectApiary;
end.

How it works

  1. procedure InspectHive(Number: Integer; const Queen: string); takes two parameters.
  2. Its body is a single WriteLn, and the procedure answers with nothing.
  3. InspectApiary calls InspectHive twice, so the main block is one statement.

Keywords and builtins used here

The run, in numbers

Lines
18
Characters to type
395
Tokens
65
Three-star pace
80 tpm

At the three-star pace of 80 tokens a minute, this run takes about 49 seconds.

Type this snippet

Step 1 of 3 in Procedures & functions, step 10 of 27 in Language basics.

← Previous Next →

Procedures in other languages