Using variables and constants
x

What changes and what stays fixed

What changes and what stays fixed

Memory diagram showing a variable called score changing from 0 to 10 to 20, a constant called MAX_SCORE staying at 100, and an assignment example score = score + 10 updating the variable

Programs often need to remember data such as scores, names, and prices. A variable is a named value that can change while the program runs, while a constant is a named value that should stay the same.

Using variables and constants Lesson

  1. GCSE
  2. /Computer Science
  3. /Using variables and constants