< Previous | Contents | Next >

Declaring and Initializing Variables

A variable represents a particular piece of your computers memory that has been set aside for you to use to store, retrieve, and manipulate data. So if you wanted to keep track of a players score, you could create a variable for it, then you could retrieve the score to display it. You could also update the score when the player blasts an alien enemy from the sky.


 

Introducing the Game Stats ProgramUnderstanding Fundamental TypesUnderstanding Type ModifiersDeclaring VariablesNaming VariablesAssigning Values to VariablesInitializing VariablesDisplaying Variable ValuesGetting User InputDefining New Names for TypesUnderstanding Which Types to Use