- E.g.,
count1 = 3;
count2 = 2;
sum = count2 + count1;
count1 = 4;
In this example, the value ofsumis 5 because the variablesumhas not been redefined or reassigned. The variablesumwill retain its value of 5 until it is assigned another value.
count1 = 3;
count2 = 2;
sum = count2 + count1;
count1 = 4; sum is 5 because the variable sum has not been redefined or reassigned. The variable sum will retain its value of 5 until it is assigned another value.