HelpContactFor teachers and institutes
>_StemPy Lab
Mock TestsClasses

>_StemPy Lab

Learn. Solve. Code the solutions. Test yourself.

Live examsFree mock exams, timed and rankedEveryone starts together, and your score and rank come the moment it ends.See the exams →

Learn

  • Physics
  • Chemistry
  • Mathematics
  • Biology
  • Python Programming
  • Statistics & Data Science
  • Computer Science
  • Classes
  • Groups

Practice

  • Problems
  • Quizzes
  • Mock Tests
  • Prepare for an Exam
  • Question Sets
  • Exams
  • Certificates
  • Python Labs
  • AI Practice Generator
  • Student-Created Tests

Community

  • Discussions
  • Resources
  • Notes
  • Glossary
  • Blog

Account

  • Log in
© 2026 senLearn. All rights reserved.HelpFor SchoolsAboutContactPrivacy PolicyTerms of UseRefund Policy
  1. Notes
  2. /Variables, Selection and Loops: Quick Revision
Computer ScienceAlso Python Programming

Variables, Selection and Loops: Quick Revision

A brief note on variables, selection and loops in Cambridge pseudocode: data types, declarations, operators, IF and CASE, the three loops, totals and counts, and the usual slips. With practice, a program and questions to check yourself.

StemPy LabWritten by StemPy Lab
Log in to save

A brief note on Variables, Selection and Loops. Read it before a test. Try each question at the end before you open its answer.

Writing pseudocode

  • Keywords in capitals. Identifiers such as NumberOfPlayers: letters and digits, a capital first, no underscore.
  • Indentation: four spaces inside a statement; THEN, ELSE and each case two spaces.
  • Comments start with //.
  • Precision: write X > Y, never "X is greater than Y".

Data and statements

  • Types: INTEGER, REAL, CHAR ('x'), STRING ("text"), BOOLEAN (TRUE, FALSE). A REAL literal has a digit on each side of the point.
  • Variable: DECLARE Counter : INTEGER. Constant: CONSTANT Rate ← 6.50, a literal only.
  • Assignment is ←. Input INPUT Answer. Output OUTPUT "Lives: ", Lives.
  • Arithmetic: + - * /, ^ for a power, DIV and MOD for whole groups and remainders.
  • Relational: = < <= > >= <>. Logical: AND, OR, NOT.

Selection and iteration

  • IF with THEN, an optional ELSE, and ENDIF. Nest up to three levels.
  • CASE OF with single values, tested in order; OTHERWISE last; ENDCASE.
  • FOR ... TO ... STEP ... NEXT for a known number of passes.
  • WHILE ... DO ... ENDWHILE tests first and may run no times.
  • REPEAT ... UNTIL tests last and runs at least once.
  • Total: set to 0 before the loop, add each value inside. Count: add 1 each time.

Practice with new numbers

A program to try

The program writes the same small task with each of the three loops, so you can see that they agree.

Read it first. Then run it. Do the three totals agree?

1. Change limit = 4 to limit = 0. Which loop still adds a value, and why?

Mistakes to avoid

  • = for assignment. Use ←; = compares.
  • The wrong band order. Test the highest band first.
  • > at a boundary where >= is meant. Test the boundary values.
  • The total set to zero inside the loop. It must be before it.
  • A WHILE condition that never changes. The loop never stops.

Check yourself

  1. What does MOD(38, 7) return?
  1. Which loop suits "ask for a PIN until it is correct"?
  1. How many times does FOR K ← 3 TO 15 STEP 4 run?
  1. Find the mistake: CASE OF Colour with OTHERWISE OUTPUT "None" as its first case.
  1. A ← 6, B ← 2. Is A > 5 OR B > 5 TRUE or FALSE?

Sources

  • Cambridge International, IGCSE Computer Science 0478 syllabus for 2026 to 2028, unit 8.1 and section 4 (pseudocode).
← All Notes
← Standard Algorithms and Validation: Quick RevisionProcedures, Functions and Strings: Quick Revision →
More onComputer Science › Programming

Discussion (0)

Log in to join the discussion.

Loading…

On this page

  1. Writing pseudocode
  2. Data and statements
  3. Selection and iteration
  4. Practice with new numbers
  5. A program to try
  6. Mistakes to avoid
  7. Check yourself
  8. Sources

Goes with the lesson

  1. Loops, totals, counts and nested statementsVariables, Selection and Loops in Pseudocode

More notes on this topic

  1. Arrays and Files: Quick Revision
  2. Procedures, Functions and Strings: Quick Revision
  3. Logic Circuits and Truth Tables: Quick Revision
  4. NAND, NOR and XOR Gates: Quick Revision
  5. NOT, AND and OR Gates: Quick Revision
All notes on this topic →