Noman
1 min readNov 27, 2020

--

Variable in Programming

Variable is like a bottle in which water is store. In programming a variable is used to store information. Variable is use to hold the value. It purpose is to store value.

How variable stores value:

In Ram there are different memory slots, when we declare variable, the computer give the specific memory slot to the variable in which we store needed information. In ram there is different size of memory slots when we declare the variable it capture the one of the memory slots in ram according to the variable data type for example in java when we declare variable (int) the computer give a memory slot of 4 bytes. Note, Variable can never be a value it contains the value it’s like a container.

There are some rules in programming language:

1: the variable name can never be start with the number for example (1num).

2: In variable name we don’t use special letters.

3: The variable name must be unique that we understand it properly for example if we use sum=10 it describe that we store the sum in the variable.

4: we use underscore instead of space if we write space than computer show an error .

--

--

Noman
0 Followers

Study Software Engineering at Comsat University Islamabad, campus wah and learning Android development