ResetStateEachLoopIterationDRAFT
All iterations of a loop start from the exact same state, the state at the beginning of the loop. They produce the exact same behavior.
The computation of all loop iterations starts from the state before the loop
The computation of a loop iteration starts from the state that is based on everything that happened before, including prior iterations of the loop
CorrectionHere is what's right.
If a loop body changes the state of the system (e.g., the position or direction of the sprite, or the value of a variable), then the next iteration of the loop body will see that updated state.
A loop iteration starts with the state left behind from everything that happened before, including all prior loop iteration.
Example with Variable
The following script will make the sprite say: 1, 2, 3, 4.
Students may incorrectly assume that it causes the sprite to say: 1, 1, 1, 1.
Example with Sprite State
The following script rotates the sprite by a total of 180 degrees. The state of the sprite (its direction) changes in the first iteration by 90 degrees, and in the second iteration by another 90 degrees, for a total of 180 degrees.
Students with the misconception might believe that the sprite only rotates a total of 90 degrees.
SymptomsHow do you know your students might have this misconception?
Empirical Evidence
Grover and Basu’s think aloud study and their Item 8d provide evidence of this misconception:
Students articulated that a loop repeats the same set of actions and expected loops to produce the exact same output in every iteration.
ValueHow can you build on this misconception?
Students might think that the code before the loop executes, and then all iterations spawn off as independent (potentially parallel) continuations. This might be an opportunity to discuss sequential versus parallel computation.