Computer programs work by manipulating values, such as the number 3.14 or the text “Hello World.” The kinds of values that can be represented and manipulated in a programming language are known as types. When a program needs to retain a value for future use, it assigns the value to (or “stores” the value in) a variable. A variable defines a symbolic name for a value and allows the value to be referred to by name.
type to a variable, and you can later assign a value of a different type to
the same variable. Variables are declared with the
uses lexical scoping. Variables declared