← the guideThe Systems Age

§ 02 — Eras · 1970

Pascal

a language small enough to teach, strict enough to trust

Left: era context, features, and the 101 hello. Right: 3 core concepts, 3 deeper 201 lessons, the factorial specimen, and where Pascal lives today — each column scrolls on its own.

creators
Niklaus Wirth, 1970
status
legacy · Delphi lives, schools moved on

The problem it solves

Students learned bad habits from forgiving languages. Pascal made correctness a habit — small, strict, and teachable in one term.

The problem it carries

Too strict for systems work: fixed-length arrays, thin I/O, and no real module story once it escaped the classroom.

Key features

strong typing
Every variable has a declared type, and the compiler enforces it on every assignment.
subrange and enumerated types
Legal values declared up front — type Hour = 0..23 — so out-of-range data cannot exist.
records and arrays
Structured data with a fixed layout, plus the standard routines for files and text.
a small surface
A language you can hold in your head — the entire point of the design.

101 — hello, world

Session one is the smallest program that still counts as speaking Pascal: what every tutorial prints first, in the dialect that mattered when the language arrived (1970).

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

101First contact — hello world and 3 ideas that define how Pascal reads. 201 — 3 lessons on mechanisms you meet after the factorial specimen: the sharp edges practitioners actually use.

101 — core concepts

3 fragments, each naming a habit of mind in Pascal. Read the note, then the code — together they are the 101 in one sitting.

01 — declared types

Types and subranges declared up front — errors caught before the first run.

type
  Hour = 0..23;
var
  noon : Hour;

02 — records

Grouped, named fields — structs by another name.

type
  Ship = record
    name : string[20];
    tons : integer
  end;

03 — the disciplined loop

One loop construct, no surprises — structure as pedagogy.

for i := 1 to 10 do
  writeln(i);

201 — going deeper

The 201 assumes you have read the 101 and the specimen. Each lesson is one mechanism — what it is for, how it looks in code, and the trap or payoff that makes Pascal distinctive at scale.

  1. pointers and linked structures
  2. variant records
  3. procedural types

pointers and linked structures

The pointer type and the record type together give Pascal its linked lists, trees and graphs — with allocation and disposal still manual.

type
  PNode = ^Node;
  Node = record
    value: integer;
    next: PNode;
  end;

variant records

One record, several layouts, discriminated by a tag field — the era’s union, and still the tidiest way to model “one of these”.

type
  Shape = record
    case tag: boolean of
      true:  (radius: real);
      false: (w, h: real)
  end;

procedural types

Pascal can pass a procedure as an argument, which is how it grows beyond the batch-file era — and the ancestor of every callback API.

type
  Op = function (a, b: integer): integer;

function apply (f: Op; a, b: integer): integer;
begin apply := f(a, b) end;

The specimen — factorial

The enforced type: ranges and records checked before the program ever ran. Wirth built a language small enough to teach and strict enough to trust.

the enforced type1970
type Hour = 0 .. 23;
var  noon : Hour;
begin
  noon := 12
end.

Run it today

installbrew install fpc

runfpc fact.pas && ./fact

Where it is now

Delphi still ships commercial Windows software; a generation learned to program from Wirth’s blue book.