Variables part 1

Variables



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!
For example, firstName and lastName are good descriptive variable names, while abc and xyz are not.

Comments