Variables can be defined as a container to store different data values which can be able to modify during program runtime.
The variable Z is a space created inside a memory for value storage. As this value can be modified, so Z can be recognized as a Variable.
In Z, three values are stored i.e. 24, 27 and 56. The value of Z varies which is known as variable. We have created a space in a memory which was given name as Z.
Syntax of variable:
var variable-name= any value;
var z= 24;
Parameter: var is a reserved keyword
Variable-name: Name of variable
Value: it can be any initial values that are assigned during declaration time.
Rules of a Variable
a) The initial character of a variable must be an underscore, letter or a dollar sign.
b) Required initialization before implementation.