Grade 11 moves from straight-line programs to programs that make decisions — and to defending those decisions against bad input.
Pascal has two selection structures. `if…then…else` handles ranges and compound conditions; `case…of` handles a list of discrete values and is far more readable when you have many of them.
Example
if mark >= 80 then WriteLn('Distinction') else if mark >= 50 then WriteLn('Pass') else WriteLn('Fail'); case grade of 'A': WriteLn('Excellent'); 'B', 'C': WriteLn('Good'); else WriteLn('Keep working'); end;
💡 Exam Tip
There is NO semicolon before else. A semicolon ends the statement, so `WriteLn('Pass');` followed by `else` is a compile error — this is the single most-tested Pascal syntax trap.
Compound conditions use the words and, or and not — and every comparison inside them must be bracketed, because in Pascal `and` binds tighter than the comparison operators.
Example
// Compile error — Pascal reads this as mark >= (0 and mark) <= 100 if mark >= 0 and mark <= 100 then // Correct if (mark >= 0) and (mark <= 100) then