Level 4

Wait Until...

Level 4 · Chapter 4

What this lesson follows

CSTA K–12 Computer Science Standards (2017)

Algorithms & Programming · Grades 6–8

Plan a hard problem with a flowchart or pseudocode.

Code 2-AP-10Read the official text

Common Core State Standards for Mathematics

Measurement & Data · Grade 5

Change between units of one system.

Code 5.MD.A.1Read the official text

The short lines are our own words. We matched this lesson to these standards ourselves; the standards' owners have not reviewed or endorsed this course.

Common Core State Standards © 2010 National Governors Association Center for Best Practices and Council of Chief State School Officers. All rights reserved.

Today you will pause a script until a condition becomes true.

1👋 Warm-Up

For teachers · goals · guide
Lesson Outcomes · for teachersCSTA 2
✦ CSTA 2-AP-10 · ISTE 1.5.c · Standards
🎯 I canpause a script until a condition becomes true
🧩 New blocks1 block
📝 New words5 words
⏱ Lesson time~35 min
Teacher Guide

📋 Before class

⚠️ Common misconceptions

  • Students often confuse wait until with forever + if. wait until pauses the whole script; forever + if keeps running other code inside the loop.
  • Students may think wait until checks only once, like if. Clarify: it keeps checking every frame until the condition is true, then releases.

🎯 Differentiation

🐢 Struggling: Show the timeline: script frozen here → condition becomes true → script continues. Draw it on paper.

🚀 Advanced: Challenge them to chain two wait until blocks in sequence: wait until touching wall, then wait until timer > 3.

💡 During the lesson

  • Warm-UpAsk: "What is a rule you follow only when something else happens first?" (Wait for the bell, wait until your name is called.) Connect this to the concept of a condition gate. When the condition is finally met, the script can resume ▶️ — continue after its pause.
  • Try ItProject all three side by side. Ask: "If you pick 3 seconds, which script says its message?" (if: only when its wait is past 2 · forever + if: yes, while Pico walks · wait until: yes, standing still.) Then ask: "What is different about wait until vs forever + if?" (wait until stops everything until the moment; forever + if keeps looping forever.)
    The first experiment is the key insight. Clicking the green flag already resets the project timer, so it acts as if reset timer were there. reset timer matters when a script starts from another event (a key press or a broadcast) long after the flag. Ask: "Why does the first experiment still wait?"
  • PlanTwo sprites need two scripts. The Pico script uses forever to move. The Star script uses wait until. Point out that the two scripts run at the same time.
  • BuildStep 7 reuses broadcast (from Level 2) as the way two sprites talk to each other. The key observation in step 10: wait until works regardless of speed.