ExamYard Lectures

Selection and iteration: IF, CASE and loops

IGCSE Computer Science 0478 · Chapter 8.1, Selection and iteration · 6-minute lecture

The teaching part (1 min) is free to watch. A free account opens the whole lecture: 9 practice questions, 2 real past-paper questions with the answers explained, the mistakes that lose marks, the full-marks tip, a one-card summary and a quick quiz.

What this lecture covers

  1. Decisions and repeats
  2. IF statements
  3. Nested IF
Read the transcript of the teaching part

Last time

Before we start: last time, in Arrays, you learned these points. Here they are again on one card. Keep them in mind, because today builds on them.

Decisions and repeats

Programs do two clever things. They decide: if the battery is low, show a warning. And they repeat: check the battery every minute. Deciding is called selection, and repeating is called iteration. Together with sequence, they build every program ever written.

IF statements

Selection means a condition is tested, and a different path is followed. IF THEN ENDIF gives one option: do something only when the condition is true. Adding ELSE gives two options. Put THEN and ELSE on their own lines, and indent, so it is easy to read.

Nested IF

The first one hundred units cost ten each. The next two hundred cost fifteen. The rest cost twenty. If units are a hundred or fewer, bill is units times ten. Otherwise, if units are at most three hundred, it is one thousand plus fifteen for each unit over a hundred. Otherwise, four thousand plus twenty for each unit over three hundred.

Chapter 8.1: Selection and iteration

Also for IGCSE Computer Science 0478

Which topics come up most in IGCSE Computer Science 0478 past papers, counted from every paper since 2004: Paper 1 topic frequency, Paper 2 topic frequency.

The topical past-paper books: Paper 1, Paper 2.