Learn in your language
Skip to content
IGCSE · Cambridge (CIE) · 0984

Repeat a fixed number of times

Use a count-controlled FOR loop when the number of repetitions is known.

Cambridge IGCSE Computer Science 0984 · Programming · 2026–2028 Version 4 · 0984 (9–1) · 8.1
Exam scope and assessment notes

This sequence follows Cambridge IGCSE Computer Science 0984, 2026–2028 syllabus Version 4. It covers section 8.1 (Programming concepts) only. Pseudocode examples use the published Cambridge format; the separate 2029–2031 syllabus is not mapped here. Practice is original, self-checked and does not award an official Cambridge grade. Full timed papers, a browser-based programming workspace and human subject-teacher review remain outstanding. Cambridge states that 0984 has the same 2026–2028 subject content as 0478, with 9–1 grading. In June and November, Cambridge lists 0984 in Administrative zone 3 and for centres in Oman and the UAE. Confirm availability for your centre and exam series with Cambridge International. The separately published 2029–2031 syllabus changes to Python 3 only and removes pseudocode; this 2026–2028 route does not cover those changes.

Before you begin

  • Be comfortable following an ordered algorithm and tracing variable values. Each lesson introduces the Cambridge pseudocode form it uses.

Work on paper. Try each question before revealing help, and explain why your method works.

Quick readiness check

What is the loop variable used for?

What you will learn

  • Set a loop variable and bounds
  • Trace the first and last iteration
  • Avoid off-by-one errors

FOR is count-controlled iteration

A FOR loop repeats for a known range, such as FOR Day ← 1 TO 7. The loop variable takes each count in the range and NEXT marks the end of the repeated statements.

The start and end are normally inclusive in Cambridge pseudocode. Check whether a requirement asks for 0 through n, 1 through n, or exactly n repetitions.

Initialise loop work before it begins

Set a total to zero before a loop that adds values. Put only repeated work inside the loop, then show the result after NEXT.

Do not change the loop variable inside its body unless the method explicitly requires it; that can skip or repeat values unexpectedly.

Pause and explain

Where should Total ← 0 appear when summing values in a FOR loop?

Put the idea to work

Worked example

Add the integers 1 to 4 with a FOR loop.

Show the worked solution
  1. Set Total ← 0 before the loop.
  2. Use Index ← 1 TO 4 and add Index each time.
  3. After NEXT, Total is 10.

Answer Total ← 0 FOR Index ← 1 TO 4 Total ← Total + Index NEXT Index OUTPUT Total // 10

Try a topic test

Choose Easy, Normal or Difficult. Save your answers and open worked review after finishing.

Test this topic →

From guided practice to a new situation

Write your answer and reasoning first. Use a hint only if you are stuck. The model solution is for self-checking; your written work is not automatically marked.

1 · Guided

How many times does FOR K ← 3 TO 7 run, and what is the first K?

Give me a hint

Count both endpoints.

Compare my reasoning
  1. The values are 3, 4, 5, 6 and 7.
  2. There are five values.
  3. The first value is 3.

Five times; K begins at 3.

Look for these in your work

  • Inclusive range
  • Count correct
2 · Independent

Write pseudocode to output each whole number from 1 to 3.

Give me a hint

Put OUTPUT inside the loop body.

Compare my reasoning
  1. Set the FOR range to 1 TO 3.
  2. Output the loop variable during each pass.
  3. Close the loop with NEXT.

FOR Number ← 1 TO 3; OUTPUT Number; NEXT Number.

Look for these in your work

  • Range correct
  • Output inside loop
3 · Transfer

A program uses FOR I ← 0 TO 10 to process ten items stored at indexes 1–10. Explain the mismatch and correct it.

Give me a hint

The range includes both 0 and 10.

Compare my reasoning
  1. The loop runs 11 times.
  2. The required indexes are 1 through 10.
  3. Change the lower bound to 1.

Use FOR I ← 1 TO 10; this visits exactly the ten valid indexes.

Look for these in your work

  • Iteration count identified
  • Index range corrected

Common mistakes

  • Starting a total inside the loop and resetting it every time
  • Using an endpoint that gives one too many or too few iterations
  • Displaying the result before the loop completes
Recall without your notes

What can you explain now?

How many times does FOR I ← 1 TO 5 execute?

Compare with the explanation

Five times

The inclusive values are 1, 2, 3, 4 and 5.

After trying it yourself, choose your next review. This is your self-assessment.

Your review choice appears on Today. Sign in to sync it across devices.

Make it stick

Why is a FOR loop a good choice when the number of repetitions is known?

If you needed the solution, close it and solve the problem again from a blank page. A correct answer is stronger when you can explain the reason for each step.

Keep learning Computer Science (9-1)

Course scope and assessment

165 original lessons map the listed objectives across all 10 main topics in the 2026–2028 Version 4 syllabus. Cambridge states that 0984 has the same subject content as 0478, with 9–1 grading. Three retained introductory lessons remain available but are not counted as syllabus-mapped teaching. The 2023–2025 syllabus remains unmapped. The separately published 2029–2031 syllabus changes to Python 3 only and removes pseudocode; this 2026–2028 route does not cover those changes. In June and November, Cambridge lists 0984 in Administrative zone 3 and for centres in Oman and the UAE. Confirm availability for your centre and exam series with Cambridge International. Practical programming in an executable browser workspace, full timed-paper practice and human subject-teacher review remain outstanding. Practice is self-checked and does not award an official Cambridge grade.

StudyForA · Learn with understanding

Original teaching content and links to official sources. Check your exam year and qualification before using a resource.