Random Tip

New Tip

Remind students that variable assignment occurs in the order assignments are given. This avoids the misconception that changing one value affects other variables assigned before it.

  • E.g.,
    count1 = 3;
    count2 = 2;
    sum = count2 + count1;
    count1 = 4;

    In this example, the value of 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.
External Source: 

"Visual program simulation in introductory programming education" by Juha Sorva, from Appendix A: Misconception Catalogue

Other Tips By: