How do variables work? How do you work with variables? And what’s up with x? Math Dude has the scoop on variables, algebra, and more.
What’s the Best Name for a Variable?
But that freedom doesn’t mean you should actually use any old name at any old time. The truth is that some variable names are better than others for certain things. For example, it’s common in physics to use the variable names E for energy and m for mass—as in E = m c^2 (you may have heard of that one). The E and m are convenient here because they serve as a quick reminder of the things they represent: energy and mass.
With that in mind, what might be a good variable name to represent the length of your new sailboat (perhaps you’re calculating if it will fit in your garage)? You could choose anything you want, but I’d say that the letter L might be a good choice since it reminds you of the word “length.” How about a variable to represent the height of the ceiling in your garage (again, to see if the boat will fit)? In that case, the letter H seems like a good choice, right? And how about the weight of your boat (to see if your garage floor will hold it)? By now you’re probably catching on that the letter W is a good choice.
Of course, there’s a bit of tradition when it comes to choosing variable names, too. For example, the variable names x, y, and z, as well as a, b, and c are commonly used as names for generic variables that don’t necessarily represent physical quantities. And, of course, they’re just fine for you to use, too. Just remember that sometimes it’s fun (and useful) to spice things up and use less-generic variable names.