The use of variables within programming allow us to store information or data. They provide us with the ability to remember, reuse and adapt information. This could be anything from words, to numbers or boolean (true/false).
Going back to our cup of tea analogy, when asking a question, we need to store a response. ‘How many sugars would you like?’ the answer to this can be saved as a number, and used later on. Even when asking would you like tea or coffee, we are saving a response.
In this program, we set a variable to the analogue value of A. We then use selection to determine whether the Sparkles need to be on (white) or off. This could be used as a simple version of a night light.