Course

Pascal from the ground up

The teaching language that still compiles

  • Beginner
  • 12 chapters
  • 179 min read

Learn Pascal by running it: the program header and writeln, variables and the five basic types, div and mod, decisions with if and begin blocks, three kinds of loop, arrays with low and high, functions and procedures with var parameters, records and arrays of records, constants and type names, text with length, copy, pos and upcase, case statements, and a capstone inventory report that uses them all.

What You'll Learn

  • Write and run a Pascal program, and know why the last end carries a period
  • Declare variables in a var block and tell integer, real, string, boolean and char apart
  • Use div and mod, and format a real so it prints the decimals you want
  • Choose a path with if then else, and group statements with begin and end
  • Repeat work with for, while and repeat until, and stop each one on time
  • Keep values in an array and walk it with low and high
  • Name work as functions and procedures, and pass a var parameter when it must change
  • Group fields into a record and hold a list of records in one array
  • Name values with const and shapes with type, in the order the compiler expects
  • Measure, slice and search text with length, copy, pos and upcase
  • Pick a branch from a list of labels with case, and catch the rest with else
  • Build a capstone: records, a constant table, running totals and a printed report

Prerequisites

  • No Pascal at all — the course starts at the program header
  • Any experience with one other language makes the early chapters quicker, but none is assumed

Course Content

  1. 01
    Your first Pascal program

    What Pascal is for, the three parts every program is built from, and your first run: three lines printed with writeln.

    Beginner · 12 min read

    Not started
  2. 02
    Variables and the five types

    Naming values in a var block, the five types a beginner needs, and how each one is printed — including the decimal that needs a format.

    Beginner · 14 min read

    Not started
  3. 03
    Arithmetic, div and mod

    The operators Pascal gives you, why div throws the fraction away, how mod returns the remainder, and the one slash that always gives a real.

    Beginner · 14 min read

    Not started
  4. 04
    Decisions with if and else

    Comparing values with the right operators, branching with if then else, and why a branch with two statements needs begin and end around it.

    Beginner · 13 min read

    Not started
  5. 05
    Three loops: for, while and repeat

    A counted for loop, a while loop that checks first, and a repeat loop that checks last — and how to tell which one a piece of work wants.

    Intermediate · 15 min read

    Not started
  6. 06
    Arrays, low and high

    Keeping a row of values under one name, choosing the indexes, and using low and high so a loop survives a change to the size.

    Intermediate · 15 min read

    Not started
  7. 07
    Functions and procedures

    Naming a piece of work: a function hands a value back through its own name, a procedure does not, and a var parameter lets it change the caller.

    Intermediate · 16 min read

    Not started
  8. 08
    Records, and arrays of them

    Grouping a name and a score into one type, reading the fields with a dot, and keeping a whole list of records in a single array.

    Intermediate · 16 min read

    Not started
  9. 09
    Naming things: const and type

    Turning a number into a name with const, giving a type a short name of your own with type, and keeping both in the order the compiler expects.

    Intermediate · 14 min read

    Not started
  10. 10
    Text: length, copy, pos and upcase

    A string is a row of characters you can measure, slice and search: length, copy, pos, upcase and the plus sign that joins two pieces.

    Advanced · 16 min read

    Not started
  11. 11
    Choosing with case

    One selector, several labelled branches: a case statement replaces a long chain of ifs, groups labels together, and never falls through.

    Advanced · 14 min read

    Not started
  12. 12
    Putting it together: an inventory report

    A capstone that uses the whole course at once: a record type, a constant table, an array of records, a loop that totals each line, and a printed report.

    Advanced · 20 min read

    Not started