{
  "id": "programming.control.while-checked-continuously",
  "uri": "https://open-misconceptions.github.io/miscon-data/m/programming.control.while-checked-continuously",
  "uuid": "8ed015e5-884f-4e76-91d6-2d5f339b2392",
  "version": "0.1.1",
  "status": "draft",
  "trust": "low",
  "title": "A while loop stops the instant its condition becomes false",
  "statement": "The condition of a while loop is watched continuously, so the loop exits in the middle of the body the moment the condition turns false.",
  "kind": "misapplied-analogy",
  "domain": "programming.control",
  "about": [
    {
      "scheme": "Miscon",
      "uri": "https://open-misconceptions.github.io/miscon-data/c/programming.control.loop"
    }
  ],
  "level_band": [
    "secondary",
    "undergraduate"
  ],
  "locale": "en",
  "evidence_patterns": [
    {
      "item_shape": "trace a while loop whose condition becomes false partway through the body",
      "signature": "stops the trace before the rest of the body runs on the final iteration",
      "example": {
        "item": "i = 0\nwhile i < 2:\n    i = i + 1\n    print(i)",
        "expected": "1\n2",
        "response": "1"
      }
    }
  ],
  "discriminators": {
    "vs_slip": "Consistent across items, especially when the update comes before other statements in the body. A slip is a single dropped line.",
    "vs": {
      "programming.control.if-is-loop": "Different statement; test each with its own item."
    }
  },
  "relations": {
    "conflicts_with": [
      {
        "external": "https://open-misconceptions.github.io/miscon-data/c/programming.control.loop",
        "label": "A loop checks its condition only at defined points and repeats its whole body"
      }
    ],
    "resolved_by": [
      {
        "external": "https://open-misconceptions.github.io/miscon-data/c/programming.control.loop",
        "label": "A loop checks its condition only at defined points and repeats its whole body"
      },
      {
        "external": "https://open-misconceptions.github.io/miscon-data/c/programming.execution.sequential-execution",
        "label": "Statements run one at a time in order"
      }
    ],
    "specializes": [
      "programming.execution.all-statements-active"
    ],
    "confusable_with": [
      "programming.control.if-is-loop"
    ]
  },
  "provenance": {
    "sources": [
      {
        "type": "paper",
        "citation": "Pea, R. D. (1986). Language-independent conceptual \"bugs\" in novice programming. Journal of Educational Computing Research, 2(1), 25-36.",
        "doi": "10.2190/689T-1R2A-X4W4-29J2",
        "note": "Parallelism bug: several lines believed to be active at once."
      },
      {
        "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"
      },
      {
        "type": "paper",
        "citation": "Swidan, A., Hermans, F., & Smit, M. (2018). Programming misconceptions for school students. In Proceedings of the 2018 ACM Conference on International Computing Education Research (ICER '18), 151-159.",
        "doi": "10.1145/3230977.3230995"
      }
    ],
    "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"
}
