if / then / else
var
score: integer;
begin
score := 72;
if score >= 70 then
writeln('First Class')
else if score >= 60 then
writeln('Second Class Upper')
else
writeln('Keep practicing');
end.
Pascal uses begin...end to group more than one statement inside a branch -- a single statement needs no begin/end at all, as above.
for loops
var
i: integer;
begin
for i := 0 to 4 do
writeln(i);
end.
for i := 0 to 4 runs with i = 0, 1, 2, 3, 4 -- 5 iterations, both ends included (unlike Python's range, which stops before its upper bound).
while loops
var
count: integer;
begin
count := 0;
while count < 3 do
begin
writeln(count);
count := count + 1;
end;
end.
break and continue
var
i: integer;
begin
for i := 0 to 9 do
begin
if i = 5 then
break; { exits the loop entirely }
if i mod 2 = 0 then
continue; { skips to the next iteration }
writeln(i);
end;
end.
Why This Matters for Your Exams
Pascal's for loop always counts a fixed number of steps, inclusive of both ends -- there is no equivalent of silently stopping one short the way range() does. Off-by-one errors here usually mean confusing to (inclusive) with an exclusive upper bound.
Try it yourself
lock
Real-time practice is a paid add-on
Reading units and the practice quiz are free. Pay once to unlock running real code for PASCAL.

