01 — declared types
Types and subranges declared up front — errors caught before the first run.
type
Hour = 0..23;
var
noon : Hour;§ 02 — Eras · 1970
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.
Students learned bad habits from forgiving languages. Pascal made correctness a habit — small, strict, and teachable in one term.
Too strict for systems work: fixed-length arrays, thin I/O, and no real module story once it escaped the classroom.
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).
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.
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);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.
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;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;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 enforced type: ranges and records checked before the program ever ran. Wirth built a language small enough to teach and strict enough to trust.
type Hour = 0 .. 23;
var noon : Hour;
begin
noon := 12
end.installbrew install fpc
runfpc fact.pas && ./fact
Delphi still ships commercial Windows software; a generation learned to program from Wirth’s blue book.