Programs typically use data to perform tasks. Creating a variable reserves a memory location, or a space in memory, for storing values. It is called variable because the information stored in that location can be changed when the program is running.
To use a variable, it must first be declared by specifying the name and data type.
A variable name, also called an identifier, can contain letters, numbers and the underscore character (_) and must start with a letter or underscore.
Although the name of a variable can be any set of letters and numbers, the best identifier is descriptive of the data it will contain. this is very important in order to create clear, understandable and readable code.
A data type defines the information that can be stored in a variable, the size of needed memory and the operations that can be performed with the variable.
For example, to store an integer value (a whole number) in a vairable, use the int keyword:
int myAge;
myAge = 18;
int myAge = 18;
There are a number of built-in data types in C#. The most common are:
- int
- float
- double
- char
- bool
- string
The statements below use C# data types:
int x = 24;
double pi = 3.14;
char y = "a";
bool isTure = true;
string myName ="Ao";








