One of the most powerful features of a programming language is the ability to manipulate variables. A variable is a name that refers to a value.
An assignment statement creates new variables and gives them values:
This example makes three assignments and then prints the value of each of the variables. The first assigns a string to a
new variable named
message; the second assigns the integer
17 to a variable named
n; and the third assigns the (approximate)
value of pi to a variable named
The type of a variable is the type of the value it refers to.