Constants and Variables
Variables
• Values which can change
• The name of a variable can be as short as a
single letter but cannot be a single number
• The name of a variable can start with a letter
or an underscore
• After the first character, any letters, numbers
or underscores can be used
• Some programming languages have reserved
words – the variable cannot be one of these
Constants
• Values which cannot change
• Can help the source code simpler to
understand
• If updates are needed and constant values are
used, they only need updating once
Question
• Where would you use constants and variables
on a game show?

Constants and Variables

  • 1.
  • 2.
    Variables • Values whichcan change • The name of a variable can be as short as a single letter but cannot be a single number • The name of a variable can start with a letter or an underscore • After the first character, any letters, numbers or underscores can be used • Some programming languages have reserved words – the variable cannot be one of these
  • 3.
    Constants • Values whichcannot change • Can help the source code simpler to understand • If updates are needed and constant values are used, they only need updating once
  • 4.
    Question • Where wouldyou use constants and variables on a game show?