Foundations
Decisions
A program that reacts: test a value, choose between paths, keep a yes or no in a box, and join questions together.
Begin — Unit 01 →What this is
A greeting can already use different input to produce different output while following the same instructions. Here we choose which instructions run: ask a question and take a path according to its answer.
Four units take that from a single test to a chain of them, to keeping an answer in a box for later, to joining questions so one test can ask about several things at once.
Who it’s for
You will use stored values and compare numbers: less than, greater than and equal to. We explain each test as it appears. The Basics and Working It Out offer more practice; prior attendance is not required. BASIC and assembly remain independent entry points.
The shape
- Making a choice —
IF, and the questions=,<and>. - One or the other —
ELSE, and a chain of questions with one answer. - A yes you can keep —
TRUEandFALSEas values, and the flag that carries an answer from where it was found to where it is needed. - Asking two things at once —
AND,ORandNOT, and brackets that say what to work out first.
Next comes Repeating. If your tests are getting tangled, Truth Tables is a short side-path from here that shows you how to be sure what a test does.