⚙️ Functions for Kids

A function is a tiny machine. Put something in, get something out.

Vending Machine

Put a coin in. Press a button. Get a snack out. The vending machine is a function: it takes an input (coin + choice) and gives an output (snack).

Naming the Machine

You give your function a name like greet or addTwoNumbers. Then you can use it again and again — different inputs, different outputs, same machine.

Why Functions?

Without functions, you'd copy-paste the same code over and over. With functions, you write it once and reuse it forever.

🎯
Try this!

Now you try! Pretend you have a function called makeSandwich that takes a filling. What would makeSandwich("cheese") return?

👨‍👩‍👧
For grown-ups

Parent/teacher tip: Vending-machine and recipe analogies both work. Encourage kids to define their own "functions" for daily tasks.