Variables are a way of giving names to data. Giving a name to data allows a program to operate on different data values each time you run a program. We can then ask Python to do something to the data with a specific name. If we only had literals, we could only ask Python to do something with one particular literal data value.
We’ve already seen a hint of just how powerful variables are when we used mouseX and mouseY in Chapter 5 to draw shapes in different places depending on the mouse position. It turns out mouseX and mouseY were just pre-made variables that Processing sets up for us. Now we’re going to learn how to use variables in general.