What are Variables?

This lesson informs about what variables are and the acceptable variables names.

We'll cover the following


A variable in any programming language is a named piece of computer memory, containing some information inside.

Think of a variable as a box with a name, where we can “store” something.

We create, edit and delete variables, as much as we need in our tasks. They are devices that are used to store data, such as a number, or a string of character data.

Naming your Variables

Programmers use symbolic names to describe variables in their minds, for instance:

  • “the depth of the snow on the mountain”


  • “the amount of money in the customer’s bank account”.

Note: The compiler assists programmers by managing the relationship between the symbolic and numeric representations of the locations of variables to reduce the number of errors that programmers would surely make if there were required to refer to every variable they have in mind purely by its current location in the memories of their computers.

C# requires the programmer to use names constructed from letters chosen from a through z, A through Z, and numbers are chosen from 0 through 9. C# considers uppercase letters to be different from lowercase letters.

Important Note: It’s a good programming practice to start variable names with small letter.

Thus C# allows:


to be used as a variable name. Some examples of types of variable names that are permitted by C# include:

Get hands-on with 1200+ tech skills courses.