Misconception: Students have trouble understanding that when the value of a variable is reassigned its previous value is irrelevant.

  • Students struggle to understand that the prior value of a variable essentially disappears because it is written over.
  • Consider the following code:

      Students are confused about the value of X after this code has run. They’re not sure whether X is 1 or 10, and sometimes even think that the two numbers are added and X is now 11.

More about this tip

External Source

Interview with Michael Lee.