What is a variable used for?

About a week ago, I made a post asking what the difference between a class, selector, and id attributes. As I am finishing up on Basic CSS, a new element has been introduced- variables. I understand the difference between what a class, selector and id attribute is but what sets them a variable apart from them? When would you use a variable and not the others?

This might be helpful:

you can’t put them togethers
id, class and other selectors are a way to select a specific elemtn (or group of elements) and style them
a variable hold a value, so you can use it in many different places in your code. You want the background of a few elements, the text color of a few others, maybe a few borders to have the same exact shade of color? you could write that color for each element. And then you want to change it, because you decided for a different palette, it means you need to change the color in 37 places… or, when you start creating the css the first time you use a variable in all 37 places, and when you want to change the color you just change the value of the variable and all 37 elements magically change color!