{
  "id": "programming.variables.variable-keeps-history",
  "uri": "https://open-misconceptions.github.io/miscon-data/m/programming.variables.variable-keeps-history",
  "uuid": "1ee84937-cc32-4577-ae23-3d6e015807c3",
  "version": "0.1.1",
  "status": "draft",
  "trust": "low",
  "title": "A variable remembers every value it has held",
  "statement": "A variable stores every value ever assigned to it, so an earlier value can still be read out later.",
  "kind": "misapplied-analogy",
  "domain": "programming.variables",
  "about": [
    {
      "scheme": "Miscon",
      "uri": "https://open-misconceptions.github.io/miscon-data/c/programming.variables.variable"
    }
  ],
  "level_band": [
    "secondary",
    "undergraduate"
  ],
  "locale": "en",
  "evidence_patterns": [
    {
      "item_shape": "trace repeated assignment to one variable and then use it",
      "signature": "uses an earlier value, or sums the values, instead of the most recent one",
      "example": {
        "item": "x = 3\nx = 5\nprint(x)",
        "expected": "5",
        "response": "3 5 (or 8)"
      }
    },
    {
      "item_shape": "accumulate in a loop",
      "signature": "expects the variable to hold the list of values seen rather than the running total",
      "example": {
        "item": "total = 0\nfor n in [1, 2, 3]:\n    total = total + n\nprint(total)",
        "expected": "6",
        "response": "1 2 3 (or 0 1 3 6)"
      }
    }
  ],
  "discriminators": {
    "vs_slip": "Consistent across items; the learner talks about the variable 'having' several values. A slip is a single wrong trace step.",
    "vs": {
      "programming.control.loop-body-variables-reset": "Resetters lose values between iterations (total becomes 3); history-keepers retain too many."
    }
  },
  "relations": {
    "conflicts_with": [
      {
        "external": "https://open-misconceptions.github.io/miscon-data/c/programming.variables.variable",
        "label": "A variable holds exactly one value at a time"
      }
    ],
    "resolved_by": [
      {
        "external": "https://open-misconceptions.github.io/miscon-data/c/programming.variables.variable",
        "label": "A variable holds exactly one value at a time"
      },
      {
        "external": "https://open-misconceptions.github.io/miscon-data/c/programming.variables.assignment",
        "label": "Assignment copies a value into a variable at one moment"
      }
    ],
    "confusable_with": [
      "programming.control.loop-body-variables-reset"
    ]
  },
  "provenance": {
    "sources": [
      {
        "type": "paper",
        "citation": "du Boulay, B. (1986). Some difficulties of learning to program. Journal of Educational Computing Research, 2(1), 57-73.",
        "doi": "10.2190/3LFX-9RRF-67T8-UVK9"
      },
      {
        "type": "paper",
        "citation": "Bayman, P., & Mayer, R. E. (1983). A diagnosis of beginning programmers' misconceptions of BASIC programming statements. Communications of the ACM, 26(9), 677-679.",
        "doi": "10.1145/358172.358408"
      },
      {
        "type": "book",
        "citation": "Sorva, J. (2012). Visual Program Simulation in Introductory Programming Education (Doctoral dissertation, Aalto University). Appendix A catalogues introductory programming misconceptions from the literature.",
        "url": "https://aaltodoc.aalto.fi/handle/123456789/3534"
      }
    ],
    "origin": "llm-drafted",
    "notes": "Drafted from the cited literature for the Open Misconceptions seed pack; statement, examples and discriminators are original text. Awaiting maintainer review."
  },
  "history": {
    "changelog": [
      {
        "version": "0.1.1",
        "date": "2026-09-05",
        "change": "Schema 0.2 migration: about/alignments carry a free-string scheme (corestandards.org URLs relabelled CCSS where present); trust computed from reviews[] (none yet, so low); no change to the statement or evidence."
      }
    ]
  },
  "license": "CC-BY-4.0"
}
