Play musical chairs to explain while loops so students develop physical experience navigating through the structure of a loop to better understand while loops.

  • When transposing the game musical chairs to a while loops, work with students to define all aspects of the while loops.
    • What is the condition under which we repeat? (boolean statement)
    • What is the event we repeat? (statements inside loop)
    • What event happens when the condition is no longer met? (what comes after the while loop ends)
  • As a group, you’ll need to define the condition, what is repeated under the condition, and what happens when the condition is over and you exit the loop.
    • The condition is "music is playing."
    • The action that happens under the condition to be repeated is "walk in circle."
    • The action that occurs after the condition has ended and the loop exits is "sit in chair."
      • while(music is playing){
        walk in circle
        }
        sit in chair

More about this tip

External Source

Interview with Dani McAvoy