Variables, Constants & Assignments (AQA GCSE Computer Science)

Revision Note

James Woodhouse

Expertise

Computer Science

  • Taking an algorithm and turning it into code, in any language, requires an understanding of several basic programming concepts such as:
    • Variables
    • Constants
    • Assignment

Variables, Constants & Assignments

What is a variable?

  • A variable is a named memory location that holds data that during the execution of a program, the data can change
  • Variables can store a variety of different types of data such as numbers, text or true/false values
  • To store data in a variable, the process of assignment is used

What is a constant?

  • A constant is fixed data that during the execution of a program cannot change
  • A constant can store a variety of different types of data, similar to variables
  • Pi is an example of a mathematical fixed value that would typically be stored as a constant

What is assignment?

  • Assignment is the process of storing data in a variable or constant under a descriptive name
  • Assignment is performed using the '=' symbol

Assigning variables & constants

Concept Pseudocode Python
Variables

x  ← 3

name  ← "Save My Exams"

x = 3

name = "Save My Exams"

Constants

CONSTANT vat  ← 0.2

CONSTANT pi  ← 3.142

VAT = 0.2

PI = 3.142

You've read 0 of your 0 free revision notes

Get unlimited access

to absolutely everything:

  • Downloadable PDFs
  • Unlimited Revision Notes
  • Topic Questions
  • Past Papers
  • Model Answers
  • Videos (Maths and Science)

Join the 100,000+ Students that ❤️ Save My Exams

the (exam) results speak for themselves:

Did this page help you?

James Woodhouse

Author: James Woodhouse

James graduated from the University of Sunderland with a degree in ICT and Computing education. He has over 14 years of experience both teaching and leading in Computer Science, specialising in teaching GCSE and A-level. James has held various leadership roles, including Head of Computer Science and coordinator positions for Key Stage 3 and Key Stage 4. James has a keen interest in networking security and technologies aimed at preventing security breaches.