Level 4

Block with Inputs

Level 4 · Chapter 6

What this lesson follows

CSTA K–12 Computer Science Standards (2017)

Algorithms & Programming · Grades 6–8

Write a function with inputs so you can reuse it.

Code 2-AP-14Read the official text

Common Core State Standards for Mathematics

Operations & Algebraic Thinking · Grade 5

Compare two number patterns.

Code 5.OA.B.3Read 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 pass values into a custom block using input parameters.

1👋 Warm-Up

For teachers · goals · guide
Lesson Outcomes · for teachersCSTA 2
✦ CSTA 2-AP-14 · ISTE 1.5.c · Standards
🎯 I canpass values into a custom block using input parameters
🧩 New blocks1 block
📝 New words5 words
⏱ Lesson time~35 min
Teacher Guide

📋 Before class

⚠️ Common misconceptions

  • Students confuse the parameter name (inside the define block) with a regular variable. The parameter only exists inside that custom block's definition — it is not a global variable.
  • Students try to set the parameter like a variable (set [size] to 50). You cannot set a parameter — you pass it when you call the block.

🎯 Differentiation

🐢 Struggling: Use a physical analogy: a cookie cutter is the define, the number you write on a tag is the parameter. Small cutter = small cookie. You do not rewrite the recipe — you just say which size.

🚀 Advanced: Add a second parameter for the ghost effect. Call walk-square with both values: walk-square (80) (25). Explore how two parameters combine in one definition.

💡 During the lesson

  • Warm-UpHold up two fingers close together, then spread them wide. Say: "Both are a gap — one is small, one is large. One block, different inputs." Students at L4 grasp the analogy quickly. Connect to math: a formula like Perimeter = 4 × side uses a variable, not a fixed number. Making one block work for many inputs is how we generalize 🔭 — the block becomes flexible 🌀.
  • Try ItAsk: "How many times did you write 'repeat 4, move, turn right'?" With parameters: once. Without: four times. The define with a parameter has an oval slot where size appears. Drag the size reporter from the define hat into the move block — students often retype the word instead, which does not work.
    Picking 60 or 100 in the third experiment shows that the same definition produces different routes depending on the argument — the key idea of parameters. Picking 20 shows the other half: equal arguments give equal results, so the cat repeats the same small square walk twice. Ask students: "The define never changed. Why did the walk change with 100 but not with 20?"
  • PlanThe plan is linear — one define, then four calls in order. A square route always ends where it started, so the cat returns to the center before each new call. That is why no repositioning blocks are needed between calls. This is a geometry connection — ask advanced students how far the cat travels in total (4 × 30 + 4 × 60 + 4 × 90 + 4 × 120 = 1200 steps).
  • BuildStep 10 is a conceptual key: same argument = same route = no growth. Step 9 shows that the whole pattern scales when every argument shrinks. Connect to art and engineering: the parameter is like a dial that controls the output.