Random glossary entry

Variables

Variables are programming structures that can change or be changed. A simple adventure game may have hitpoints as a variable, as the game progresses the number of hitpoints can be adapted by the program depending on the users choices. Variables can contain numbers or text. The programming language keeps a record or what is currently assigned within a variable at all times. So a score variable can be reported to the user at any time whilst the program is being run. When talking about variables with students the box analogy works best. The programmer creates a box called score and the user adds, takes things away or looks in the box. Using a physical box and counters helps students to comprehend what is happening as the program progresses.