Level 6

Remember in Order

Level 6 · Chapter 3

What this lesson follows

CSTA K–12 Computer Science Standards (2017)

Algorithms & Programming · Grades 6–8

Name variables well and work with their values.

Code 2-AP-11Read the official text

Also practised: 2-AP-13

Common Core State Standards for Mathematics

Expressions & Equations · Grade 6

Use a letter for a number that can change.

Code 6.EE.A.2Read 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 use a Scratch list to save items in order, then take them back — for undo and order replay.

1👋 Warm-Up

For teachers · goals · guide
Lesson Outcomes · for teachersCSTA 2
✦ CSTA 2-AP-11 · CSTA 2-AP-13 · ISTE 1.5.c · Standards
🎯 I canuse a Scratch list to save items in order, then take them back — for undo and order replay
📝 New words7 words
⏱ Lesson time~45 min
Teacher Guide

📋 Before class

⚠️ Common misconceptions

  • Students take item 1 for both jobs. To undo, take the LAST item (the newest move). To replay messages in order, take the FIRST item. The difference is which end you take from.
  • Students try to make a custom block hand back a value. A Scratch custom block cannot hand back a value — use a result variable that the caller reads after the block runs.
  • Students forget the empty case. The take block checks length > 0 and sets result to EMPTY; the caller must still check result before using it.

🎯 Differentiation

🐢 Struggling: Build only the take-last (undo) blocks first. Use the list monitor to watch add and remove in slow motion. Add the message replay only after take-last is clear.

🚀 Advanced: Add a redo list so R brings back a move that U took away, and clear the redo list when a new move is saved.

💡 During the lesson

  • Warm-UpBefore the lesson, show the idea with books. Add 5 books to a pile, one at a time — each add puts one on top. Now take one back: you grab the top (last) book first, because it is the newest. That is exactly how undo works — the last move you made is the first one taken back. Then line up 5 students; the one who lined up first goes first. Two simple rules: take the last, or take the first. Today's list does both.
  • Try ItThe key visual: draw the list as a row of boxes on the board — new items join the end. To undo, take from the END (the newest). To replay in order, take from the FRONT (the oldest). Both use the same Scratch list; only the end you take from changes the behavior.
    The third experiment is critical. When item (length of [empty list]) is called, Scratch returns an empty string. The result variable will be empty, not an error. This is a silent failure — the program keeps running but gives a wrong value. Students who say "nothing bad happens" need to be challenged: "What if your undo takes from an empty list — what move does it try to take back?"
  • PlanThe core build saves only the x position (1D undo) — add_last (x position) stores one number, and undo glides back to x:(result) y:(-80). This keeps Part B simple enough for every student. Advanced only: for a 2D undo, keep two lists — saved_x and saved_y — and add to both on every move. Do not require this of the whole class — it is offered as an Extend challenge (🟡 full position saver).
  • BuildStep 10's script has an intentional extra take to show the EMPTY result. Students who are confused can count: 3 added, then 4 taken — the 4th must return EMPTY. This shows why an empty check matters in real systems.