The Storage Boxes

Test yourself on Variables & Constants with exam style questions, marked instantly.

Flashcards that come back just before you would forget them.

A revision plan that remembers what you know and shows what to do next.

See which topics you have nailed and which need another look.

Quiz yourself on Variables & ConstantsGet your flashcardsBuild my revision planTrack my progress

The Storage Boxes

Think of computer memory as a warehouse full of boxes. A variable is a labelled box where you can store data - and change what's inside whenever you want. The label (name) stays the same, but contents can change: "score = 10" then later "score = 15". A constant is a sealed box - once you put something in, it can never change. Use constants for things like PI = 3.14159 or VAT_RATE = 0.20.

A variable named score holds 0, then 10 after adding 10, then 25 after adding 15, so its value changes. Below it, a padlock marks three constants: PI is 3.14159, VAT_RATE is 0.20 and MAX_SIZE is 100. Their values do not change while the program runs.

The variable score changes from 0 to 10 to 25. The padlock marks constants, which are set once and never change. In OCR pseudocode a variable is written score = score + 10 and a constant is written const VAT_RATE = 0.2. Edexcel does not set a strict pseudocode style.

Make this stick

Signing in gives access to all PrepWise features.

PrepWise is a trading name of A3M Quality Solutions Limited, registered in England and Wales, company number 14959172. Registered office: 202 Stroud Road, Gloucester, GL1 5LA. ICO registration ZC267069.