← Back to the map
🧰 Builder's Toolkit

πŸ“œ Recipes

Recipes illustration

Imagine telling a friend how to do a silly dance: β€œhop, turn, hop.” Now imagine you could give that whole thing a name β€” β€œDance” β€” and from then on just say β€œdo the Dance” instead of listing every step. πŸ’ƒ

That one idea is how programmers build huge things without losing their minds. They call it a function; let's just call it a recipe.

1

The big idea: name it once, use it forever

A recipe is just a bunch of steps with a name. Once you name it, you don't repeat the steps anymore β€” you say the name and all the steps happen. (Grown-up programmers call this a function.)

The magic trick: recipes can be made out of other recipes. So a giant job becomes a short list of names, each name a smaller list of names… all the way down. That's how a whole game fits in a brain: it's recipes inside recipes, and you only ever look at one little piece at a time.

2

Your turn: teach the robot recipes

Build the Dance recipe out of basic moves. Then build Big Show β€” and notice it can use your whole Dance as a single block. Run them and watch the recipe unpack into steps.

Build a recipe below, then press Run to watch the robot perform it. πŸ€–

πŸ’ƒ Dance

🌟 Big Show

πŸ’‘ Big Show uses πŸ’ƒ Dance as a single block. Change Dance, then run Big Show again β€” it changes too, without you touching Big Show!

3

Discovery missions

Try each one, tick it off, then peek at the secret.

0/5
  • ✏️Run Dance. Then add a 🦘 Hop to the Dance recipe and run it again. How much did you have to rewrite?

  • πŸ”’Run Big Show. Look at the strip of little steps β€” is it longer than the number of blocks in Big Show?

  • πŸ”Change the Dance recipe, then run Big Show WITHOUT touching Big Show. What happens?

  • πŸ«™Make the Dance recipe empty, then run Big Show.

  • 🦸Think back to your game. Every chapter drew the hero. Did anyone re-draw it from scratch each time?

🌟 New thinking tool unlocked! You now know:

πŸ“šNext in the toolkitLists & Loops β†’One row of boxes β€” and one rule that runs on every single one.
← Back to the map