Library › Computer Science 0478 › Programming Concepts
O Level · Computer Science 0478

Programming Concepts

Revise Programming Concepts for Computer Science 0478 (O Level) — revision notes and instant AI marking.

📖 Revision notes · preview
Cambridge (CIE) IGCSE Computer Science · 0478

Programming Concepts

Every program — no matter how complex — is just data being stored, moved, and controlled using a small toolkit of building blocks: variables, sequence, selection, iteration, and sub-programs. Master these building blocks and you can read or write any program in pseudocode or Python.

Quick Overview

  • Variables & Constants — named boxes that store data; variables can change, constants can't.
  • Data Types — INTEGER, REAL, CHAR, STRING, BOOLEAN — the "shape" of data.
  • Input & Output — how a program talks to the user (keyboard in, screen out).
  • Sequence — code runs top to bottom, one line at a time, in order.
  • Selection — IF and CASE statements that make decisions and branch the flow.
  • Iteration — FOR, WHILE, REPEAT loops that repeat code.
  • Totalling & Counting — running-total and counter patterns inside loops.
  • String Handling — case conversion, length, substrings.
  • Operators — arithmetic (+ - * /), relational (== > <), Boolean (AND OR NOT).
  • Procedures & Functions — reusable named blocks of code; functions return a value, procedures don't.
  • Local & Global Variables — where a variable "lives" and who can see it.
  • Library Routines — pre-built, tested code like RANDOM() and ROUND().
  • Maintaining Programs — writing readable, well-structured code that's easy to fix later.

Variables & Constants

What's actually going on here?

Think of your computer's memory as a giant wall of lockers. A variable is a labelled locker where you can put something in, take it out, and swap it for something else — as many times as you like while the program runs. The label (the identifier) never changes, but the contents can.

A constant is also a labelled locker, but it's sealed with a value at the start and never opened again for the rest of the program's life. This matters more than it sounds — if you use the literal number 3.142 for π in fifteen different places in your code and then discover you need more precision, you have to hunt down and change all fifteen. If you'd used CONSTANT PI ← 3.142 instead, you change it in exactly one place.

Naming rules for identifiers

Cambridge is picky about this, and it's an easy mark to lose. An identifier (the name of a variable, constant, procedure, or function) must:

  • Be in mixed case — also called Pascal case, e.g. FirstName, not firstname or FIRSTNAME
  • Only contain letters (A–Z, a–z) and digits (0–9)
  • Start with a capital letter — and never start with a digit
Why capital-letter naming for identifiers, but ALL CAPS for constants?

It's a visual convention. The moment you see HIGHSCORE written in a program, your eyes instantly know "this value never changes" without reading any more code. It's a readability signal, not a rule the computer enforces.

Declaring a variable

Pseudocode syntax DECLARE <identifier> : <datatype>
Pseudocode
DECLARE Age : INTEGER
DECLARE Price : REAL
DECLARE GameOver : BOOLEAN
Python
score = int()   # whole number
cost = float()  # decimal number
light = bool()  # True/False only

Declaring a constant

Pseudocode syntax CONSTANT <identifier> ← <value>
Pseudocode
CONSTANT PI ← 3.142
CONSTANT PASSWORD ← "letmein"
CONSTANT HIGHSCORE ← 9999
Python
PI = 3.142
VAT = 0.20
PASSWORD = "letmein"
Common mistake

no built-in "constant" keyword PI = 3.142

🔓 Read the full Programming Concepts note → You're seeing the preview · sign in to read it all
Also in the full note
  • Arithmetic, Logical & Boolean Operators
  • What to Memorise
  • Concepts Checklist
  • Exam Tips
  • A sequencing bug in action
  • IF statements
  • Nested Selection
  • Count-Controlled Loops (FOR)
What's inside
📖 Revision notes 🎯 Learn mode ✦ AI flashcards ✓ Instant AI marking 🧊 3D explorers 🧪 Experiments & simulations 📈 Progress tracking
📄 Practise Programming Concepts with Computer Science 0478 past papers Every paper with its mark scheme — answer online, marked instantly. Open →

Read the full Programming Concepts notes free

That's the preview — create a free account to read the rest, plus flashcards and practice questions with instant AI marking. No credit card.

Unlock the full notes free →

More Computer Science topics