miscon:programming.control.while-checked-continuously · draft · trust low · v0.1.1 · kind misapplied-analogy

A while loop stops the instant its condition becomes false

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.

Stable URI
https://open-misconceptions.github.io/miscon-data/m/programming.control.while-checked-continuously
UUID
8ed015e5-884f-4e76-91d6-2d5f339b2392
Domain
programming.control
Level band
secondary, undergraduate
Locale
en
About
https://open-misconceptions.github.io/miscon-data/c/programming.control.loop (Miscon)

Evidence patterns

Pattern 0: trace a while loop whose condition becomes false partway through the body

stops the trace before the rest of the body runs on the final iteration

Itemi = 0 while i < 2: i = i + 1 print(i)
Expected1 2
Response1

Discriminators

vs a 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
A loop checks its condition only at defined points and repeats its whole body (external)
resolved_by
A loop checks its condition only at defined points and repeats its whole body (external)
Statements run one at a time in order (external)
specializes
programming.execution.all-statements-active
confusable_with
programming.control.if-is-loop

Provenance

Origin: llm-drafted

  1. 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
    Parallelism bug: several lines believed to be active at once.
  2. Sorva, J. (2012). Visual Program Simulation in Introductory Programming Education (Doctoral dissertation, Aalto University). Appendix A catalogues introductory programming misconceptions from the literature. link
  3. 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

Drafted from the cited literature for the Open Misconceptions seed pack; statement, examples and discriminators are original text. Awaiting maintainer review.

Review status

Status draft, trust low (computed from the reviews below against the reviewer registry).

No reviews yet.

Formats

Cite

miscon:programming.control.while-checked-continuously
https://open-misconceptions.github.io/miscon-data/m/programming.control.while-checked-continuously