Misconception: Students don’t understand that the right side of an assignment statement is executed before the assignment. They think that variables store unresolved equations.

  • For example, statements like x = y + 1 are unintuitive because the right side of the equality is executed before the assignment.
    • Especially since many students are used to reading from right to left, the order of execution takes extra effort to internalize.
  • Remind students that variables always resolve expressions to a value or an object since students may believe that variables can store unresolved mathematical expressions.
    • When we have the assignment var1 = var2 + var3, they assume that a change to var2 or var3 after this assignment will change var1 change without explicitly reassigning var1.
    • This is because they think var1 holds the expression var2+var3 not the value of the result.

More about this tip

External Source

Interview with Helen Hu.

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