Variables and Constants

KS3 Computer Science

11-14 Years Old

48 modules covering EVERY Computer Science topic needed for KS3 level.

GCSE Computer Science

14-16 Years Old

45 modules covering EVERY Computer Science topic needed for GCSE level.

A-Level Computer Science

16-18 Years Old

66 modules covering EVERY Computer Science topic needed for A-Level.

GCSE Variables and Data Types (14-16 years)

  • An editable PowerPoint lesson presentation
  • Editable revision handouts
  • A glossary which covers the key terminologies of the module
  • Topic mindmaps for visualising the key concepts
  • Printable flashcards to help students engage active recall and confidence-based repetition
  • A quiz with accompanying answer key to test knowledge and understanding of the module

A-Level Introduction to programming (16-18 years)

  • An editable PowerPoint lesson presentation
  • Editable revision handouts
  • A glossary which covers the key terminologies of the module
  • Topic mindmaps for visualising the key concepts
  • Printable flashcards to help students engage active recall and confidence-based repetition
  • A quiz with accompanying answer key to test knowledge and understanding of the module

Variables and constants are two commonly used mathematical concepts.  A variable is a value that has the ability to change.  A constant is a value that remains unchanged.

These concepts have branched out into other fields, like physics and computer science.

 Variables

In the mathematical framework, a variable is a quantity that has a dynamic or a variable magnitude.  In algebra, it is represented by an English or a Greek letter.  The general rule is to call this symbolic letter the variable.

Uses of Variables

  • Variables are used in equations, functions, geometry, and identities.
  • Variables are used to represent unknowns in equations.
  • Variables are used to represent a rule between two unknown quantities.
  • Variables are used to assume different states or events in the considered set of events, in probability and statistics.

In mathematics, it is usual to highlight the acceptable values for the variable, which is called the range. These restrictions are conceived from the general properties of the equation or by definition.

variables and constants

Categorisation of Variables

  • Independent variable – the variable’s changes are not based on other factors. In statistics, it is referred to as an explanatory variable.
  • Dependent variable – the variable’s changes are based on some other variable(s). In statistics, it is referred to as a response variable.

The term variable is used in the field of computing too, especially in programming.  It points to a lump of memory in the program, where varying values can be saved.

 In programming, a variable is a value that can vary, depending on circumstances or on information sent to the program.  Usually, a program contains commands that tell the computer what to do, as well as data that the program utilises while running.  The data contains constants or fixed values that are permanent, as well as variable values.  Variable values are usually initialised to 0, or some similar default value because the actual values will be supplied by the program’s user.  Usually, both constants and variables are defined as certain data types.  Each data type both recommends and restricts the form of the data.  Data types such as an integer are represented as a decimal number, just like a represents string of text characters, both of which are usually limited in length.

In object-oriented programming, each object has the data variables of the class it is an instance of.  The object’s methods are designed to handle the actual values that are supplied to the object when the object is being used.

Constants

In mathematics, a constant is a quantity that does not change its value.  Constants, like variables, are also symbolised by an English or a Greek letter. Usually, constants signify a real number that has special functionalities in the background of the problem or the scenario in which it is being used.

Constants can also be used to represent decimals or irrational numbers of interest, as well as very large numbers, which are not easily manipulated in a mathematical expression, in its fully fleshed-out numerical representation.

Constants are used to signify numbers with physical implications. In natural sciences like physics and chemistry, you will come across constants which are specific letters assigned to represent values of quantities in nature, or a mathematical theory.  The Universal constant of Gravitation, which is often symbolised by G, and Planck’s constant (which is symbolised by h), are both examples of this kind of constant usage.

 Difference between Variables and Constants

  • Variables are quantities with changing magnitudes, and as such can assume different values depending on the application in question. Constants are quantities with permanent, values and are used to signify numbers with special significance.
  • Both constants and variables are denoted algebraically by English or Greek letters.
  • Constants are used to characterise quantities in nature which are permanent, while variables are used to represent unknowns.

Further Readings: