NEW Explore the Scratch Block Dictionary, tutorials, textbook, and classroom guides

Start learning →

Chapter 12: My Blocks (Custom Functions & Parameters)

📌 What you will learn

Break large scripts into named, reusable building blocks with custom inputs.

Lesson goal & core concept

Reduce duplicate code and use "Run without screen refresh" safely for instant drawing or collision resolution.

When a custom block is called, Scratch runs its definition from top to bottom and returns right back to the caller.

Step-by-step practice

Work through these steps in the Scratch editor, predicting each result before clicking the green flag.

  • Identify repeated code (like drawing a shape or resetting the player).
  • Create a My Block with clear parameter names (e.g., sides, size).
  • Call the same block multiple times with different numbers.
  • Keep "wait" blocks out of "Run without screen refresh" definitions.
Chapter 12: My Blocks (Custom Functions & Parameters) — Example
  1. Define (Draw Polygon sides size)
  2. Repeat sides
  3. Move size steps
  4. Turn clockwise (360 / sides) degrees

Try it: Draws triangles, squares, or octagons with one clean custom block.

Mini challenge & next steps

Call Draw Polygon three times in a row with different sizes to create nested geometric art.

Scratch Learning Textbook Home Return to the full 4-stage curriculum overview. Learn more → Scratch Block Dictionary Look up any block used in this chapter. Learn more →

FAQ

How long should I spend on "Chapter 12: My Blocks (Custom Functions & Parameters)"?

Aim for 15–20 minutes: read the concept, test the small example, modify one value to see what changes, and try the mini challenge.

This guide is provided for educational purposes. Scratch screens and terms may change over time, so please check the official Scratch website as well.